Skip to content

Instantly share code, notes, and snippets.

@thomersch
Last active December 11, 2018 23:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomersch/43e6dbc1b6b2ec9ffb00e92659765b81 to your computer and use it in GitHub Desktop.
Save thomersch/43e6dbc1b6b2ec9ffb00e92659765b81 to your computer and use it in GitHub Desktop.
ffmpeg cheat sheet
# average bit rate encoding
ffmpeg -i $INPUT -c:v libx264 -b:v $BITRATE $OUTPUT.mp4
# mux
ffmpeg -i video.mov -i audio.flac -c:v copy -c:a aac muxed.mp4
ffmpeg -i video.mov -i audio.flac -c copy muxed.mkv # mkv takes any codec combination
# remux
ffmpeg -i v.mp4 -i a.wav -c:v copy -map 0:v:0 -map 1:a:0 new.mp4
# demux
ffmpeg -i video.mov -vn -c:a copy audio.wav
# remove audio
ffmpeg -i input.mov -c:v copy -an output.mov
# Timelapse from images
ffmpeg -r 24 -pattern_type glob -i '*.JPG' -vcodec libx264 timelapse.mp4
# Batch Convert to H.265
for i in *.MOV; do ffmpeg -i $i -c:v libx265 -crf 17 $i.mp4; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment