Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
FFMPEG Optimize videos for YouTube

Command

$ ffmpeg -i <input file> -codec:v libx264 -crf 21 -bf 2 -flags +cgop -pix_fmt yuv420p -codec:a aac -strict -2 -b:a 384k -r:a 48000 -movflags faststart <output_name>.mp4

Function

function youtube () {
	( ffmpeg -i $1 -codec:v libx264 -crf 21 -bf 2 -flags +cgop -pix_fmt yuv420p -codec:a aac -strict -2 -b:a 384k -r:a 48000 -movflags faststart $2.mp4 )
}

Source from this article

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.