ffmpeg concat doesn't work with absolute path
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
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.
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
@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!