# 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


## 8 Answers

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.

• 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, 2018 at 10:08

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

• I guess this is the only correct answer to keep absolute paths for both list file and the source files inside it. Thanks. Jun 30, 2020 at 15:44
• Use CMD to generate absolute path configuration file on Windows (for %i in (*.ts) do @echo file 'file:%cd%\%i') > mylist.txt Sep 25, 2020 at 4:32
• The single quotes in your example are also essential, I tried it with double quotes and it wouldn't work. Thanks for sharing. May 1, 2021 at 3:25
• This needs to be upvoted to the high heavens. Jun 4, 2021 at 18:46

@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!


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.

• I need to use a file since I can have a lot of video. And I need absolute path in the file Feb 17, 2014 at 16:28
• I can't, the file are on a network drive and in multiple folder. I can't force a specific directory Feb 17, 2014 at 16:36
• I have this error with absolute path: Impossible to open 'C:/temp/ffmpeg/c:/temp/ffmpeg/01.mov' Feb 17, 2014 at 16:43
• You are getting the error because you command is wrong. See the answer. Feb 17, 2014 at 16:46
• 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 Mar 4, 2018 at 18:04

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
...

• Missing " character? Dec 16, 2014 at 14:29

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.

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.

I had to move text & binaries to same directory so I don't have to include paths to binaries when concating.

The forward slash / instead of backslash \ technique seems to work with ffmpeg, although I've wasted half a day of debugging before coming to this post, which rectified the problem in seconds.

I can go back to old code where there's no need to move files & cd everytime to concat.

Tested on Win 10