Skip to content

Instantly share code, notes, and snippets.

@joequery
Created April 25, 2012 04:31
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 joequery/2486369 to your computer and use it in GitHub Desktop.
Save joequery/2486369 to your computer and use it in GitHub Desktop.
FFMpeg H264 encode_video function
# encode a video
# arg1: video origin
# arg2: destination
function encode_video(){
ffmpeg -y -i $1 -pass 1 -vcodec libx264 -b 756k -g 15 -bf 3 -refs 6 -b_strategy 1 -coder 1 -qmin 10 -qmax 51 -sc_threshold 40 -flags +loop -cmp +chroma -me_range 16 -me_method umh -subq 7 -i_qfactor 0.71 -qcomp 0.6 -qdiff 4 -directpred 3 -flags2 +dct8x8+wpred+bpyramid+mixed_refs -trellis 1 -partitions +parti8x8+parti4x4+partp8x8+partp4x4+partb8x8 -acodec libfaac -ab 64k $2
ffmpeg -y -i $1 -pass 2 -vcodec libx264 -b 756k -g 15 -bf 3 -refs 6 -b_strategy 1 -coder 1 -qmin 10 -qmax 51 -sc_threshold 40 -flags +loop -cmp +chroma -me_range 16 -me_method umh -subq 7 -i_qfactor 0.71 -qcomp 0.6 -qdiff 4 -directpred 3 -flags2 +dct8x8+wpred+bpyramid+mixed_refs -trellis 1 -partitions +parti8x8+parti4x4+partp8x8+partp4x4+partb8x8 -acodec libfaac -ab 64k $2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment