View Single Post
Old 29th May 2017, 21:03   #6  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,078
Alright, here are the FFmpeg calls for a 2-pass VBR encode using parameters for "Extremely High Quality".


Convert.bat
Code:
ffmpeg.exe -i "I:\test.mp4" -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 16:9 -s 720x480 -r 24000/1001 -g 12 -pix_fmt yuv420p -b:v:0 7990000 -maxrate:v:0 8000000 -dc 10 -bf 2 -q:v 2 -bufsize:v:0 1835008 -packetsize 2048 -muxrate 10080000 -vf scale=718:480,pad=720:480:1:0 -map 0:v:0 -an -passlogfile "I:\ffmpeg" -pass 1 -y "NUL.avi"


ffmpeg.exe -i "I:\test.mp4" -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 -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 16:9 -s 720x480 -r 24000/1001 -g 12 -pix_fmt yuv420p -b:v:0 7990000 -maxrate:v:0 8000000 -dc 10 -bf 2 -lmin 0.75 -mblmin 50 -qmin 1 -bufsize:v:0 1835008 -packetsize 2048 -muxrate 10080000 -vf scale=718:480,pad=720:480:1:0 -map 0:v:0 -passlogfile "I:\ffmpeg" -pass 2 "I:\test.m2v" -f ac3 -b:a 192000 -ar 48000 -c:a:0 ac3 -map 0:a:0 "I:\test.ac3"

IF EXIST "I:\ffmpeg*.log" DEL "I:\ffmpeg*.log"

All the bold parts need to be modified for different sources and targets. This one is only for progressive sources. For target NTSC it encodes to 23.976 fps, pulldown must be added by your authoring application.

If your source file is 30fps progressive then you might get smoother results by replacing "24000/1001" with "30000/1001". This will avoid the fps conversion from 30fps to 23.976fps which is performed by FFmpeg by just dropping whole frames.

My test source had a frame size of 426x240, to keep the correct aspect ratio some padding was added using the "-vf scale" and "pad" parameters. You need to calculate these values manually for each different source. Depending on your source frame size you might be able to remove the whole "-vf" parameter.

You just need to save this code as a batch file and put this batch file into a folder where you have a current version of FFmpeg.


Good luck
manolito

Last edited by manolito; 11th September 2019 at 15:12.
manolito is offline   Reply With Quote