Skip to content

Instantly share code, notes, and snippets.

@persianturtle

persianturtle/ffmpeg

Last active Jan 10, 2017
Embed
What would you like to do?
List of useful ffmpeg commands
// Convert 4444/422 to WEBM
ffmpeg -i input.mov -c:v libvpx -qmin 0 -qmax 25 -crf 4 -b:v 1M -vf scale=1280:-2 -an -threads 0 output.webm
// Enable audio
ffmpeg -i input.mov -c:v libvpx -qmin 0 -qmax 25 -crf 4 -b:v 1M -threads 0 output.webm
// Convert 4444/422 to WEBM - Smaller bitrate
ffmpeg -i input.mov -c:v libvpx -qmin 0 -qmax 25 -crf 4 -b:v 256k -vf scale=1280:-2 -an -threads 0 output.webm
ffmpeg -i input.mov -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis output.webm
// WebM with Vorbis audio
ffmpeg -i input.mov -c:v libvpx -crf 10 -b:v 1M -codec:a libvorbis -qscale:a 5 output.webm
// Two pass
ffmpeg -i input.mov -codec:v libvpx -quality good -cpu-used 0 -b:v 1M -aspect 16:9 -qmin 10 -qmax 42 -maxrate:v 1M -bufsize:v 1000k -r:v 25/1 -force_fps -threads 0 -acodec libvorbis -ac 2 -ab 196k -ar 44100 -pass 1 -f webm -y /dev/null && ffmpeg -i input.mov -codec:v libvpx -quality good -b:v 1M -aspect 16:9 -qmin 10 -qmax 42 -maxrate:v 1M -bufsize:v 1000k -r:v 24/1 -force_fps -threads 0 -acodec libvorbis -ac 2 -ab 196k -ar 44100 -pass 2 -f webm -y output.webm
// Webm to Mp4
ffmpeg -fflags +genpts -i input.webm -r 24 output.mp4
// Mov to MP4
ffmpeg -i input.mov -qscale 0 output.mp4
// Compressed Mov to Webm
ffmpeg -i input.mov -c:v libvpx -crf 4 -b:v 256k -an -threads 0 output.webm
// Compressed Mov to MP4
ffmpeg -i input.mov -pix_fmt yuv420p -qscale 31 output.mp4
// Scale Mov to Webm & Webm to MP4
ffmpeg -y -i input.mov -vf scale=960:-1 -auto-alt-ref 0 -qmin 10 -qmax 40 -crf 30 -c:v libvpx -b:v 600k -c:a libvorbis -ar 48000 -b:a 128k 960x540-recompressed.webm
ffmpeg -y -i input.webm -vf scale=960:-1 -auto-alt-ref 0 -qmin 10 -qmax 40 -crf 30 -c:v libx264 -b:v 600k -c:a aac -ar 48000 -b:a 128k 960x540-recompressed.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment