Skip to content

Instantly share code, notes, and snippets.

@ziyunli
Last active March 31, 2016 19:36
Show Gist options
  • Save ziyunli/ec879f31491c51e1ac495b1e6c74a3c0 to your computer and use it in GitHub Desktop.
Save ziyunli/ec879f31491c51e1ac495b1e6c74a3c0 to your computer and use it in GitHub Desktop.
ffmpeg cheatsheet
# use reinstall if ffmpeg has already been installed via homebrew
brew install ffmpeg --with-fdk-aac --with-ffplay --with-freetype --with-libass --with-libquvi --with-libvorbis --with-libvpx --with-opus --with-x265
# export the movie to frames using ffmpeg then make the GIF with convert from ImageMagick
# from http://superuser.com/questions/556029/how-do-i-convert-a-video-to-gif-using-ffmpeg-with-reasonable-quality#
mkdir frames
ffmpeg -i input -vf scale=320:-1:flags=lanczos,fps=10 frames/ffout%03d.png # export frames
convert -loop 0 frames/ffout*.png output.gif
# Add an empty audio track to video
# The silence comes from /dev/zero and -shortest makes the process stop at the end of the video.
# Argument order is significant here; -shortest needs to be down near the output file spec.
ffmpeg -ar 44100 -acodec pcm_s16le -f s16le -ac 2 -channel_layout 2.1 -i /dev/zero -i <input> -vcodec copy -acodec aac -shortest <output>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment