Skip to content

Instantly share code, notes, and snippets.

@westerlund
Last active November 15, 2017 08:29
Show Gist options
  • Save westerlund/91c8ab1e0f54c87c0b5d to your computer and use it in GitHub Desktop.
Save westerlund/91c8ab1e0f54c87c0b5d to your computer and use it in GitHub Desktop.
Common ffmpeg commands

common ffmpeg commands

common arguments

-y overwrite without asking
-r frame rate
-vf eq=1:0:1.1:1:1:1:1:1 change colors. contrast : brightness : saturation : gamma : gamma r : gamma g : gamma b : weight
-vf scale=width:height scale/resize. -1 will leave preserved ratio, for instance 320:-1 will resize to 320 in width and keep ratio
-ss seek to position
-t duration, trim to a certain length
-r frame rate, useful when creating gifs

time formats

ffmpeg uses the following format for specifying time
[HH:]MM:SS[.m...]
explained: [optional hours]minutes:seconds[.optional decimals]

or

S+[.m...]
explained: seconds [.optional decimals]

lower quality:

ffmpeg -i input.mov -x264opts bitrate=1300:vbv-maxrate=2000 -vcodec libx264 output.mov
about 10mb / min

create a dithered gif:

ffmpeg -i input.mov -vf scale=0:-1:sws_dither=ed -r 10 output.gif
scale=0 // don’t rescale

export movie to images

ffmpeg -i input.mov image-%d.png

trim 10 seconds in and cut 5, total time will be 15 seconds

ffmpeg -i input.mov -ss 10:00 -t 5 output.mov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment