14

I'm using ffmpeg inside my .net application to merge(concatenate) some short videos with the same encoding and width and height dimensions. I've created a txt file as the documentation says and this is my txt:

concatTextDirectory is directory of my txt file.

file 'C:\Users\mtst\Desktop\Clips\keep\a1.mp4'
file 'C:\Users\mtst\Desktop\Clips\keep\a2.mp4'
file 'C:\Users\mtst\Desktop\Clips\keep\a3.mp4'
file 'C:\Users\mtst\Desktop\Clips\keep\a4.mp4'
file 'C:\Users\mtst\Desktop\Clips\keep\a5.mp4'

And this is ffmpeg argument part:

ffmpeg.StartInfo.Arguments = "/c ffmpeg.exe -f concat -i " + concatTextDirectory + " -c copy " + videoOut + " -y -report";

but it has no result and below is the report

ffmpeg started on 2016-04-25 at 19:02:30 Report written to
"ffmpeg-20160425-190230.log" Command line: ffmpeg.exe -f concat -i
"C:\Users\mtst\Desktop\Clips\keep\keep.txt" -c copy
"C:\Users\mtst\Desktop\Clips\keep\keep.mp4" -y -report ffmpeg
version N-79546-g13406b6 Copyright (c) 2000-2016 the FFmpeg
developers built with gcc 5.3.0 (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-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmfx --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib libavutil 55. 22.100 / 55. 22.100 libavcodec 57. 35.100 / 57. 35.100 libavformat 57. 34.102 / 57. 34.102 libavdevice 57. 0.101 / 57. 0.101 libavfilter 6. 44.100 / 6. 44.100 libswscale 4. 1.100 / 4. 1.100 libswresample 2. 0.101 / 2. 0.101 libpostproc 54. 0.100 / 54. 0.100 Splitting the commandline. Reading option '-f' ... matched as option
'f' (force format) with argument 'concat'. Reading option '-i' ...
matched as input file with argument
'C:\Users\mtst\Desktop\Clips\keep\keep.txt'. Reading option '-c' ...
matched as option 'c' (codec name) with argument 'copy'. Reading
option 'C:\Users\mtst\Desktop\Clips\keep\keep.mp4' ... matched as
output file. Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'. Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'. Finished
splitting the commandline. Parsing a group of options: global .
Applying option y (overwrite output files) with argument 1. Applying
option report (generate a report) with argument 1. Successfully
parsed a group of options. Parsing a group of options: input file
C:\Users\mtst\Desktop\Clips\keep\keep.txt. Applying option f (force
format) with argument concat. Successfully parsed a group of options. Opening an input file: C:\Users\mtst\Desktop\Clips\keep\keep.txt.
[file @ 00000000027d3ee0] Setting default whitelist 'file,crypto'
[concat @ 00000000027d3800] Unsafe file name
'C:\Users\mtst\Desktop\Clips\keep\a1.mp4' [AVIOContext @
0000000000957ca0] Statistics: 238 bytes read, 0 seeks
C:\Users\mtst\Desktop\Clips\keep\keep.txt: Operation not permitted

as you can see at the end it says:

Unsafe file name 'C:\Users\mtst\Desktop\Clips\keep\a1.mp4'

... and Operation not permitted. I've tried adding extra backslashes or change backslashes to forward slashes or escaping double colon, adding double quote or single quote at the beginning or end of concatTextDirectory... none of these changes made any result.

24

Either run

ffmpeg.exe -f concat -safe 0 -i
"C:\Users\mtst\Desktop\Clips\keep\keep.txt" -c copy
"C:\Users\mtst\Desktop\Clips\keep\keep.mp4

Or don't use absolute (full) paths in keep.txt

  • What isn't safe and why? The example in documentation shows absolute paths, so I think that's not the problem. – Gustavo Rodrigues Nov 8 '16 at 21:16
  • 1
    ffmpeg.org/pipermail/ffmpeg-devel/2013-February/138400.html – causes absolute paths to be treated as unsafe. Not sure about the logic of it though! – jamadagni Jan 20 '17 at 13:04
  • I also thought it was suppose to be absolute paths based on docs but apparently that's not right. I made it just filenames and it worked great. – Michael Tunnell Jul 11 at 3:47

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.