Skip to content

Instantly share code, notes, and snippets.

@doniz
Forked from radavis/ffmpeg.md
Last active August 29, 2015 14:14
Show Gist options
  • Save doniz/bc49c2e25bfb79fe32c0 to your computer and use it in GitHub Desktop.
Save doniz/bc49c2e25bfb79fe32c0 to your computer and use it in GitHub Desktop.

Sample ffmpeg Commands

Convert to 480p

ffmpeg -i input.mp4 -s hd480 -c:v libx264 -crf 23 -c:a aac -strict -2 output.mp4

Convert to 720p via scaling, copy audio

ffmpeg -i input.mp4 \
  -c:v libx264 -preset medium -tune film -crf 22 -vf scale=-1:720 \
  -c:a copy \
  output.mp4

Convert to 720p via scaling, encode 128kbit audio

ffmpeg -i input.mp4 \
  -c:v libx264 -preset medium -tune film -crf 22 -vf scale=-1:720 \
  -c:a libfdk_aac -b:a 128k \
  output.mp4

-preset Options

Set the encoding speed to compression ratio. Faster compression yields a larger file.

  • ultrafast
  • superfast
  • veryfast
  • faster
  • fast
  • medium
  • slow
  • slower
  • veryslow

References

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