Skip to content

Instantly share code, notes, and snippets.

@bivald
Last active November 6, 2020 11:27
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save bivald/9832302 to your computer and use it in GitHub Desktop.
Save bivald/9832302 to your computer and use it in GitHub Desktop.
FFmpeg commands
# TO MP4 (with quicktime/windows media player support)
# Convert to 720 MP4 (roughly 7MB for 30 seconds)
ffmpeg -i input.mp4 -s hd720 -c:v libx264 -crf 23 -c:a aac -strict -2 -pix_fmt yuv420p output.mp4
# Convert to 1080 MP4 (roughtly 60MB for 30 seconds) - high resolution, but not RAW
ffmpeg -i input.mp4 -s hd1080 -c:v libx264 -crf 23 -c:a aac -strict -2 -pix_fmt yuv420p output.mp4
# Animated gif to mp4
ffmpeg -i input.gif -strict -2 -pix_fmt yuv420p output.mp4
# Convert to AVI
ffmpeg -i input.mp4 -q:a 2 -q:v 2 -s hd720 output.avi
# Convert to WMV
ffmpeg -i input.mp4 -q:a 2 -q:v 2 -s hd720 output.wmv
@bivald
Copy link
Author

bivald commented Jun 3, 2014

Or to run them via shell (run with original filename as first parameter)

#!/bin/bash
ffmpeg -i $1 -s hd1080 -c:v libx264 -crf 23 -c:a aac -strict -2  -pix_fmt yuv420p $1-mp4-output.mp4
ffmpeg -i $1 -q:a 2 -q:v 2 -s hd720 $1-avi-output.avi
ffmpeg -i $1 -q:a 2 -q:v 2 -s hd720 $1-wmv-output.wmv

@bivald
Copy link
Author

bivald commented Apr 2, 2016

Or for youtube-dl: youtube-dl https://youtu.be/.... --recode-video mp4 --postprocessor-args ' -s hd1080 -c:v libx264 -crf 23 -c:a aac -strict -2 -pix_fmt yuv420p '

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