View Single Post
Old 30th May 2017, 22:46   #8  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,078
Good to hear that it works for you...

IMO the requested output bitrate is generally met quite well in FFmpeg 2-pass VBR mode. It did happen a couple of times for me that the bitrate was a little lower, and the reason was that the source movie had end credits which did not require many bits. FFmpeg did use a quantizer of 0 for these end credits, but it was not enough to bring the overall bitrate up to the requested value.

The passlog file can be anywhere on your HDD. Just don't delete it before finishing the second pass.

Pasting the FFmpeg params into the command line is possible, but not for both passes at once. You need to paste the params for the first pass first, then run the first pass. After the first pass has finished you can paste the params for the second pass and execute it.

I think using a batch file which runs both passes with one command is easier...

To make it even easier I modified the batch file for much better usability:

Convert.bat
Code:
@ECHO off

====================================================
SET aspect=16:9
SET size=720x480
REM SET vfilter=-vf scale=718:480,pad=720:480:1:0
SET framerate=29.97
SET VBitrate=8000k
SET logfile=%temp%\ffmpeg
SET ABitrate=192k
SET AChannels=2
====================================================






SET FF_DRIVE=%~d0
SET FF_PATH=%~p0
%FF_DRIVE%
CD "%FF_PATH%"
SET in="%~1"
SET in_path=%~dp1
SET in_name=%~n1
SET Vout="%in_path%%in_name%.m2v"
SET Aout="%in_path%%in_name%.ac3"


ffmpeg.exe -i %in% -f mpeg2video -c:v:0 mpeg2video -b_strategy 2 -brd_scale 2 -profile:v 4 -intra_matrix "8,8,9,9,10,10,11,11,8,9,9,10,10,11,11,12,9,9,10,10,11,11,12,12,9,10,10,11,11,12,13,13,10,10,11,11,12,13,13,14,10,11,11,12,13,13,14,15,11,11,12,13,13,14,15,15,11,12,12,13,14,15,15,16" -inter_matrix "8,8,9,9,10,10,11,11,8,9,9,10,10,11,11,12,9,9,10,10,11,11,12,12,9,10,10,11,11,12,13,13,10,10,11,11,12,13,13,14,10,11,11,12,13,13,14,15,11,11,12,13,13,14,15,15,11,12,12,13,14,15,15,16" -aspect %aspect% -s %size% -r %framerate% -g 12 -pix_fmt yuv420p -b:v:0 %VBitrate% -maxrate:v:0 8500000 -dc 10 -bf 2 -q:v 2 -bufsize:v:0 1835008 -packetsize 2048 -muxrate 10080000 %vfilter% -map 0:v:0 -an -passlogfile "%logfile%" -pass 1 -y "NUL.avi"


ffmpeg.exe -i %in% -f mpeg2video -c:v:0 mpeg2video -pre_dia_size 5 -dia_size 5 -qcomp 0.7 -qblur 0 -preme 2 -me_method dia -sc_threshold 0 -sc_factor 4 -bidir_refine 4 -profile:v 4 -mbd rd -mbcmp satd -precmp satd -cmp satd -subcmp satd -skipcmp satd -intra_matrix "8,8,9,9,10,10,11,11,8,9,9,10,10,11,11,12,9,9,10,10,11,11,12,12,9,10,10,11,11,12,13,13,10,10,11,11,12,13,13,14,10,11,11,12,13,13,14,15,11,11,12,13,13,14,15,15,11,12,12,13,14,15,15,16" -inter_matrix "8,8,9,9,10,10,11,11,8,9,9,10,10,11,11,12,9,9,10,10,11,11,12,12,9,10,10,11,11,12,13,13,10,10,11,11,12,13,13,14,10,11,11,12,13,13,14,15,11,11,12,13,13,14,15,15,11,12,12,13,14,15,15,16" -aspect %aspect% -s %size% -r %framerate% -g 12 -pix_fmt yuv420p -b:v:0 %VBitrate% -maxrate:v:0 8500000 -dc 10 -bf 2 -lmin 0.75 -mblmin 50 -qmin 1 -bufsize:v:0 1835008 -packetsize 2048 -muxrate 10080000 %vfilter% -map 0:v:0 -passlogfile "%logfile%" -pass 2 %Vout% -f ac3 -b:a %Abitrate% -ar 48000 -ac %AChannels% -c:a:0 ac3 -map 0:a:0 %Aout%

IF EXIST "%logfile%*.log" DEL "%logfile%*.log"

Now you can set all your parameters right at the top of the file. The input clip is the first (and only) parameter for the batch file. This makes it possible to Copy&Paste or Drag&Drop the input clip on the batch file (or on a link to the batch file on your desktop).


Enjoy
manolito
manolito is offline   Reply With Quote