top of page

FFMPEG Cheat Sheet

Updated: Sep 1, 2022


horsing around

My favourite is how easy it is to generate animated gifs.


Since I'm a Linux user (and even on OSX), I find that some software has poor support for different types of file formats. I use ffmpeg to quickly convert files from one codec to another. Sometimes it can also be used to export frames. FFMPEG is also quite easy to use to batch convert a bunch of videos.


The only hurdle with FFMPEG is that it is primarily a command line tool. For some, this is a bit of a daunting task.

I've made a quick cheat sheet that I tend to use on a regular basis and I'll continue to add to this list when I discover more useful commands.


Visit ffmpeg.org for more info



batch:

for i in *.mov; do ffmpeg -i "$i" -c:v prores -profile:v 3 -c:a copy "./wip_prores/${i%.*}_wip_prores.mov";done

Quick convert:

ffmpeg -i input.mp4 output.mov

exr to QT:

ffmpeg -y -i input.%04d.exr -c:v libx264 -pix_fmt yuv420p -preset slow -crf 17 output.mov

prores HQ:

ffmpeg -i input.mp4 -c:v prores -profile:v 3 -c:a copy output.mov

prores options between v 0 to v 5

-profile: v0 =proxy
-v 1 = LT
-v 2 = LQ
-v 3 = 4444
-v 4 = 4444hq


video to frames:

ffmpeg -i input.mov output.%04d.jpg

exr to video

ffmpeg -y -gamma 2.2 -i input.%04d.exr -vcodec libx264 -pix_fmt yuv420p -preset slow -crf 18 -r 25 output.mov

frames to video (-r = fps):

ffmpeg -r 24 -start_number 1 -i input.%04d.jpg -c:v prores -profile:v 3 -c:a copy output.mov

frames to video (preview quality)

ffmpeg -r 24 -f image2 -start_number 1 -i input.%04d.jpg -vcodec libx264 -crf 15 -pix_fmt yuv420p output.mp4

video to gif:

ffmpeg -i input.%04d.jpg -vf "fps=24, scale=320:-1:flags=lanczos" output.gif

optional flags:

-vf "fps=24, scale=320:-1:flags=lanczos"

fps = frames per second

scale = width of image

-1 = scale height proportionally

lanczos = scaling filter https://ffmpeg.org/ffmpeg-scaler.html


Extract video:

ffmpeg -i inputVideo.mp4 -ss 00:03 -to 00:08 -c:v libx264 -crf 30 trim_opseek_encode.mp4

Extract audio:

ffmpeg -i audio.aac -acodec libmp3lame audio.mp3
ffmpeg -i audio.aac audio.wav
ffmpeg -i audio.aac -acodec ac3 audio.ac3
ffmpeg -i audio.aac -libvorbis audio.ogg

Concatenate video:

ffmpeg -f concat -i list.txt -c copy out.mp4

file 'zoom_0_b.mp4'

file 'zoom_0_a.mp4'


Speed up / Slow down video:

ffmpeg -i input.mkv -filter:v "setpts=0.5*PTS" output.mkv
ffmpeg -i input.mkv -filter:v "setpts=2.0*PTS" output.mkv



If you happen to have some useful and easy tricks using FFMPEG, let me know and I'll add it to the list.

Recent Posts

See All

Comments


bottom of page