General Chat (#3) - ffmpeg 2pass encoding basics (#99) - Message List
Hello,
I've been experimenting with ffmpeg & h264 encoding. The aim is having a .ts input, and creating 4 to 7 different bitrate .mp4 outputs. The output is then transmuxed to smoothstreaming.
I realized that there is a good potential in 2pass encoding, especially in low bitrates. I've tried to reproduce the 2pass encoding described in this site. encoding is as below :
set INPUTFILE=big_buck_bunny_1080p_h264.mov
set OUTFILE_PREFIX=sample
set AUDIO_NONE=-an
set AUDIO_OPTIONS=-acodec libfaac -ac 2 -ab 48k
set VIDEO_OPTIONS= -g 50 -keyint_min 1 -flags2 -mbtree -refs 4
set VIDEO_PASS1=-vcodec libx264 -vpre veryfast_firstpass -vpre baseline %VIDEO_OPTIONS%
set VIDEO_PASS2=-vcodec libx264 -vpre veryfast -vpre baseline %VIDEO_OPTIONS%
ffmpeg -threads 0 -y -i %INPUTFILE% -an %VIDEO_PASS1% -pass 1 -b %BITRATE_2%k -s %RESOLUTION_2% %OUTFILE_PREFIX%_%BITRATE_2%k.mp4
ffmpeg -threads 0 -y -i %INPUTFILE% -an %VIDEO_PASS2% -pass 2 -b %BITRATE_2%k -s %RESOLUTION_2% %OUTFILE_PREFIX%_%BITRATE_2%k.mp4
ffmpeg -threads 0 -y -i %INPUTFILE% -an %VIDEO_PASS2% -pass 2 -b %BITRATE_3%k -s %RESOLUTION_3% %OUTFILE_PREFIX%_%BITRATE_3%k.mp4
ffmpeg -threads 0 -y -i %INPUTFILE% -an %VIDEO_PASS2% -pass 2 -b %BITRATE_6%k -s %RESOLUTION_6% %OUTFILE_PREFIX%_%BITRATE_6%k.mp4
ffmpeg -threads 0 -y -i %INPUTFILE% -an %VIDEO_PASS2% -pass 2 -b %BITRATE_7%k -s %RESOLUTION_7% %OUTFILE_PREFIX%_%BITRATE_7%k.mp4
ffmpeg -threads 0 -y -i %INPUTFILE% -an %VIDEO_PASS2% -pass 2 -b %BITRATE_8%k -s %RESOLUTION_8% %OUTFILE_PREFIX%_%BITRATE_8%k.mp4
So I am making a 1st pass with the highest output bitrate, then I make 2nd passes for all output bitrates, from highest to the lowest. What I wonder is, is this approach correct ? having only one 1st pass when aim is having multiple bitrates? will the log file generated in the first bitrate, be used for other bitrates as well?
-
Message #544
Hi Caglar,
Yes, it is correct, and yes the stats file created in the 1st pass is used by all the 2nd passes.
Reference: http://smoothstreaming.code-shop.com/trac/wiki/Smooth-Streaming-Encoding-FFmpeg
Regards,
arjen04/02/11 09:15:06 (14 months ago)
