Encoding h.264 Video with ffmpeg

Until now this page is just a reminder for myself. Explanation of the parameters may follow some time.

 
# firstpass
 
ffmpeg -an -pass 1 -threads 4 -i inputfile.mpg -vcodec libx264 -b 1000k -flags +loop+mv4 -cmp 256 \
          -partitions +parti4x4+parti8x8+partp4x4+partp8x8+partb8x8 \
          -me_method hex -subq 7 -trellis 1 -refs 5 -bf 3 \
          -flags2 +bpyramid+wpred+mixed_refs+dct8x8 -coder 1 -me_range 16 \
	  -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -qmin 10 \
          -qmax 51 -qdiff 4 \
          temp.mp4
 
# second pass
ffmpeg -i inputfile.mpg -acodec libfaac -ar 44100 -ab 128k -pass 2 -threads 4 \
          -vcodec libx264 -b 1000k -flags +loop+mv4 -cmp 256 \
          -partitions +parti4x4+parti8x8+partp4x4+partp8x8+partb8x8 \
          -me_method hex -subq 7 -trellis 1 -refs 5 -bf 3 \
          -flags2 +bpyramid+wpred+mixed_refs+dct8x8 -coder 1 -me_range 16 \
	  -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -qmin 10 \
          -qmax 51 -qdiff 4 \
          temp.mp4
 
#rename
mv temp.mp4 outfile.mp4
pixelstats trackingpixel

Leave a comment

Your comment

Time limit is exhausted. Please reload the CAPTCHA.