FFmpeg Tips and Tricks
Some useful tips that I have been using.
In the past few weeks, I have been using FFmpeg to modify some video and audio files. I been having found a few productive tips/tricks that I thought would be good to share.
If you have anything good to share, please feel free to leave a comment below.
Loop Video
If you have a short video and would like to extend it for a long duration. For example, if you have a bokeh design that you would like to loop over and over again.
This loops a GoPro video file 4 times it's current length:
ffmpeg -stream_loop 4 -i GH010375.MP4 -c copy output.mp4
Loop Audio
Looping audio works the exact same way.
This is useful when you want to extend a background sound, such as Apple's Playful for a longer duration.
This code snippet extends the 1-minute clip to 25 minutes. This saves me time in having to duplicate the clip multiple times in Final Cut Pro.
ffmpeg -stream_loop 25 -i PLAYFUL-EndlessLoop.m4a -c copy LongPlayful25.m4a
Combine Video
This is very useful when dealing with when the camera splits a video clip because of the 4GB limit. (This is something that the GoPro does.)
In this first example, We create a reference file and then combine the video clips.
cd ~/Desktop/GoPro/ printf "file '%s'n" *.MP4 > clips.txt ffmpeg -f concat -i clips.txt -c copy GoPro.mp4
In this example, we call out the files on the command line, without using the reference file. Here's an example:
ffmpeg -i "concat:GX010197.MP4|GX010198.MP4" -c copy ~/Desktop/output.mp4