⬅ All snippets

ffmpeg invocations


Here's a list of ffmpeg filters/commands I use often but still can't recall from memory. I'll try to include the original source wherever I can find it. Since the original sources do a great job at explaining the options, I'm not going to repeat them here.

· · ·

Index

· · ·

Extract audio from video [source]

  ffmpeg -i input-video.mp4 -q:a 0 -map a output-audio.mp3

Convert mp4 to gif [source]

  ffmpeg -i input-video.mp4 -vf "fps=10,scale=-1:720:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 output.gif

Change video speed [source]

This particular example speeds up the video by 2x

  ffmpeg -i input-video.mp4 -filter:v "setpts=0.5*PTS" output-video.mp4

Stacking videos [source]

  ffmpeg -i input-video-1.mp4 -i input-video-2.mp4 -filter_complex [hstack|vstack] output-video.mp4

Concatenate videos [source]

  ffmpeg -i input-video-1.mp4 -i input-video-2.mp4 -filter_complex "[0:v] [0:a] [1:v] [1:a] concat=n=2:v=1:a=1 [v] [a]" -map "[v]" -map "[a]" output-video.mp4
· · ·