Cheat Sheet - ffmpeg

Cheat Sheet - ffmpeg

Lossless video from images

ffmpeg -framerate 10 -i image%05d.png -c:v copy output.mkv

CRF Notes

"-crf": for x264 range is 0-51 (0=lossless, 51=worst), 23 is default, consider 18 to be visually lossless

Benchmark/Measure time taken

ffmpeg -benchmark -pattern_type glob -f image2 -i "photos/*.jpg" -c:v libx264 -r 30 -crf 18 output.mp4

Get media file info

ffmpeg -i video.avi

Join/concatenate two MP4 videos

ffmpeg -i one.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts one.ts
ffmpeg -i two.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts two.ts
ffmpeg -i "concat:one.ts|two.ts" -c copy -bsf:a aac_adtstoasc combined.mp4
# cleanup
rm -f one.ts two.ts

Smoothing out a video...

ffmpeg -i input.mp4 -filter:v "minterpolate='mi_mode=mci:mc_mode=aobmc:vsbmc=1:fps=30'" output.mp4

Crop a video

ffmpeg -i input.mp4 -filter:v "crop:1920:1080:100:50" output.mp4

Create timelaps

ffmpeg -framerate 30 -pattern_type glob -i "folder-with-photos/*.JPG" -s:v 1440x1080 -c:v libx264 -crf 17 -pix_fmt yuv420p my-timelapse.mp4
ffmpeg -r 30 -f image2 -patern_type glob -j "photos/*.jpg" output.mp4
ffmpeg commands.
ffmpeg commands. GitHub Gist: instantly share code, notes, and snippets.