Search code examples
javascriptnode.jsvideoffmpeg

ffmpeg-concat created almost 80GB of raw files to merge 3 videos with 500ms crossfade of total size about 42MB. how to reduce storage requirement?


Yes, I was quite shocked when I found out that my videos were not concatenated due to lack of storage. Then I tried to debug and on the bash terminal I found location of temp files that ffmpeg-concat created.

Good thing is that it deletes these files automatically once the conversion is done but the amount of disk space it used is shocking. It took almost 70-80GB of storage for creating video of about 42MB and probably this is the reason why it takes about 15-20min to create video of about 3-6min.

I tried a lot of other ways like ffmpeg -safe 0 -f concat -i mylist.txt -c copy o.mp4, but it created very bad video -- all I could see on video is random colors.

Can anyone suggest a better alternative to concat 3 videos, if possible with crossfade transition.


Solution

  • ffmpeg-concat appears to extract all input frames to images, process them to a new set of images and then stitch them back using ffmpeg. The default format for image is uncompressed RGB. This will take a lot of space as you discovered. You can switch to PNG by setting --frame-format.

    Alternatively, if you just need a simple crossfade, you can use the xfade filter in ffmpeg. For usage hints, see Merging multiple video files with ffmpeg and xfade filter