15

I need to use concat with absolute path, but it doesn't seem to work. In the doc it says it should work. Anyone have an idea how to make it work? ffmpeg Doc

It doesn't work because it seem to append the text file directory to the file path

Impossible to open 'C:/temp/ffmpeg/c:/temp/ffmpeg/01.mov'

I use Windows 7.

ffmpegTest.txt:
file 'c:/temp/ffmpeg/01.mov'
file 'c:/temp/ffmpeg/02.mov'

"Y:/Shotgun/bin/ffmpeg/bin/ffmpeg.exe" -f concat -i "C:/temp/ffmpeg/ffmpegTest.txt" -c copy "C:/temp/ffmpeg/test.mov
ffmpeg version N-58949-g0e575c2 Copyright (c) 2000-2013 the FFmpeg developers
  built on Dec  9 2013 22:06:49 with gcc 4.8.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 58.100 / 52. 58.100
  libavcodec     55. 45.100 / 55. 45.100
  libavformat    55. 22.100 / 55. 22.100
  libavdevice    55.  5.102 / 55.  5.102
  libavfilter     3. 92.100 /  3. 92.100
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
[concat @ 0000000000337920] Impossible to open 'C:/temp/ffmpeg/c:/temp/ffmpeg/01.mov'
C:/temp/ffmpeg/ffmpegTest.txt: Invalid argument
16

I just ran into similar error messages. I eventually figured it out. There were two issues.

Issue 1:

When doing

ffmpeg -f concat -i <path_to_text_file> ...

the path_to_text_file must use forward slashes, not backslashes, even in Windows. This rule doesn't seem to apply for the video file paths on the command line though -- only for the text file path on the command line.

Issue 2:

The paths listed within your text file are interpreted by ffmpeg as being relative to the location of your text file. (In particular, the paths listed are not relative to the current working directory.)

Thus, for example, if the video files you're trying to concatenate together are in the same directory as your text file (but different than the current working directory), then the paths listed in your text file should simply be the video file names without any preceding directories.

Hope this helps someone in the future.

| improve this answer | |
  • The paths listed within your text file are interpreted by ffmpeg as being relative to the location of your text file. There is a bug in ffmpeg under windows, which is highlighted in my answer – Leon Nov 12 '18 at 10:08
2

You can either use a text file that is a list of input files like so:

ffmpeg -f concat -i ffmpegTest.txt -c:v copy output.mov

OR

You can explicitly name the files like so:

ffmpeg.exe -f concat -i 'c:/temp/ffmpeg/01.mov' -i 'c:/temp/ffmpeg/02.mov' -c:v copy 'C:/temp/ffmpeg/output.mov'    

Note that you use 2 inputs one after another, and then use -c:v copy to say that there should be no re-encoding- only joining. Also, this is the concat demuxer. This is flexible, but does require the 2 input files to have same codecs.

The content of the text file is as you wrote:

file 'c:/temp/ffmpeg/01.mov'
file 'c:/temp/ffmpeg/02.mov'

Note the single quotes

The generic format is:

file '/path/to/file1'
file '/path/to/file2'
file '/path/to/file3'

That would apply to multiple drives and paths.

Here is a real example of a concatenation file that works:

file '/run/media/rnx/New Volume1/PREMIER_OUTPUTEST/Sequence004.mpeg'
file '/home/rnx/Sequence003.mpeg'
file '/run/user/rnx/gvfs/users on edtmchn/Public/Sequence01.mpeg'

This is across :
One internal drive
One external USB Drive
One Network drive on another windows machine on the same domain

The command use is :

ffmpeg -f concat -i conc.txt -c:v copy -strict -2 output.mpeg

This works as expected without any errors.

| improve this answer | |
  • 1
    I need to use a file since I can have a lot of video. And I need absolute path in the file – DarkPixel Feb 17 '14 at 16:28
  • I can't, the file are on a network drive and in multiple folder. I can't force a specific directory – DarkPixel Feb 17 '14 at 16:36
  • I have this error with absolute path: Impossible to open 'C:/temp/ffmpeg/c:/temp/ffmpeg/01.mov' – DarkPixel Feb 17 '14 at 16:43
  • You are getting the error because you command is wrong. See the answer. – Rajib Feb 17 '14 at 16:46
  • 1
    This answer works on ffmpeg version N-90173, Win10, CMD prompt only if the -i parameter does NOT have single quotes and does NOT use forward slashes: -i C:\foo\bar\filelist.txt – Jay Borseth Mar 4 '18 at 18:04
2

Notice; on Windows, if you are using concat with a textfile, the paths in the textfile need to be relative to the output path.

E.g.

ffmpeg -f concat -i file.txt "C:\foo\file.mp4"

If your files are located in the directory C:\temp\bar.mp4 your textfile looks like this:

file ..\temp\bar.mp4
...
| improve this answer | |
2

Use

ffmpeg.exe" -f concat -safe 0 -i fileWithAbsoluePaths.txt -c copy out.mov

In your case

"Y:/Shotgun/bin/ffmpeg/bin/ffmpeg.exe" -f concat -safe 0 -i "C:/temp/ffmpeg/ffmpegTest.txt" -c copy "C:/temp/ffmpeg/test.mov

The key is -safe 0. That allows you to put absolute paths in the txt file.

| improve this answer | |
2

@Eric's answer provides an important instruction to allow full paths in the concat demuxer input (you must provide the -safe 0 option to ffmpeg). However, under Windows, ffmpeg's concat demuxer doesn't correctly handle absolute/full paths starting with the disk name. Though it correctly recognizes full paths in its security checks, it misinterprets such paths as relative (because they don't start with a slash) when opening the file. Since non-absolute paths are relative to the location of the concat demuxer input script, ffmpeg prepends the path of the latter to the file path. If the concat script command line argument doesn't contain any file path separators (i.e. is a just a filename) the problem is masked.

Illustration:

concat.txt:
file 'c:/videos/01.flv'
file 'c:/videos/02.flv'


ffmpeg -f concat -safe 0 -i "C:/temp/concat.txt" -c copy "C:/temp/test.flv"
...
[concat @ 0000000000abcdef] Impossible to open 'C:/temp/c:/videos/01.flv'
C:/temp/concat.txt: Invalid argument


cd C:\temp
ffmpeg -f concat -safe 0 -i "./concat.txt" -c copy "C:/temp/test.flv"
...
[concat @ 0000000000abcdef] Impossible to open './c:/videos/01.flv'
./concat.txt: Invalid argument


ffmpeg -f concat -safe 0 -i "concat.txt" -c copy "C:/temp/test.flv"
# Works successfully!
| improve this answer | |
2

With the current version of ffmpeg (May 10 2020), on Windows 10, the list file must contain the ffmpeg form of a file URL. Using the OP's list file, the contents of it would need to be:

file 'file:c:/temp/ffmpeg/01.mov'
file 'file:c:/temp/ffmpeg/02.mov'

-safe 0 is still required

See also https://trac.ffmpeg.org/ticket/2702

| improve this answer | |
  • I guess this is the only correct answer to keep absolute paths for both list file and the source files inside it. Thanks. – hypers Jun 30 at 15:44
-1

While cmd.exe is case-insensitive, ffmpeg isn't (being built primarily on linux, it tends towards *nix shell conventions). If you change the c: on each line of your input file to C:, it should work, I think.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.