ffmpeg+libx264编码H.264的视频
ffmpeg+libx264不是装好就能work的,具体来说,需要在ffmpeg的命令行中加入一些option才能工作,具体请看这篇文章。
下面是正确的命令行:
x264 – Recommended General Options
For all rate control methods you will probably want libx264 to select the number of threads to use to maximise its performance on your CPU(s):
-threads 0
Two-Pass Example
So if you wanted to encode using two-pass VBR, the command line would be something like:
ffmpeg -i INPUT -an -pass 1 -vcodec libx264 -vpre slow_firstpass -b BIT_RATE -bt BIT_RATE -threads 0 OUTPUT.mp4
Note: We don’t encode the audio in the first pass because we will not be using the data that was output.
ffmpeg -i INPUT -acodec libfaac -ab 128k -pass 2 -vcodec libx264 -vpre slow -b BIT_RATE -bt BIT_RATE -threads 0 OUTPUT.mp4
Single-Pass Constant Rate Factor (CRF) Example
Or for a single pass CRF encode:
ffmpeg -i INFILE -acodec libfaac -ab 96k -vcodec libx264 -vpre slow -crf 22 -threads 0 OUTPUT.mp4