Log in

View Full Version : ffmpeg CLI syntax for encoding DVD Remux please


bjoker
9th October 2020, 08:23
Hi,

Source NTSC DVD Remux - specs: ( Mediainfo = https://pastebin.com/dRTLVWFC )
1) It has 720 x 480 resolution.
2) PAR should be 40/33 - tried to pass "--sar 40:33" to x264
3) cropping should be Crop(2,50,-0,-42) so used filter:v "crop=718:390:2:50"
4) De-interlacing needs to be done so used -vf yadif as one of 5 frames is duplicate.

so tried - (to encode first 10 min)
Z:\>ffmpeg -y -i "ABCD_Source.mkv" -ss 0 -t 600 -filter:v "crop=718:390:2:50" -vf yadif -vcodec libx264 -preset placebo -crf 16 -refs 16 -sar "40:33" -x264-params "me=umh:subme=11:bframes=16:deblock=-3,-3:no-dct-decimate=1:rc-lookahead=100:me_range=48:keyint_min=23" -acodec copy ABCD_ffm2.mkv

But it throws the below error:
[matroska @ 00000199d16f1e80] Aspect ratio mismatch between muxer (186/157) and encoder layer (40/33)
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Error initializing output stream 0:0 --
Conversion failed!

Then I tried without "-sar 40:33" , it encodes but with wrong o/p resolution 720:480. Expected is 718x390 with display size 870x390 as 718*(40/33)=870.30.

Please advise correct ffmpeg command with deinterlacing, cropping and SAR/PAR/DAR parameter for a DVD remux source. It would be good to include Color matrix

Thanks!

manolito
9th October 2020, 18:23
Hi,

first of all your post is in the wrong thread. You are converting to AVC (H.264), so the post belongs in the MPEG4-AVC thread. Can a mod please move it...

Not being an FFMpeg specialist I usually let an encoder GUI do all the aspect ratio math. For FFmpeg I use dmMediaConverter, and for a source like yours it created this command line:
ffmpeg.exe -fflags +genpts -y -i "I:\My.mkv" -map 0:0 -filter:v:0 "yadif,crop=718:388:2:50,scale=718:-2" -c:v:0 libx264 -preset:v:0 medium -tune:v:0 film -profile:v:0 high -level:v:0 4.1 -crf:v:0 18 -map 0:1 -c:a:0 copy "I:\My converted.mkv"

Please note that the crop filter needs to be follwed by the scale filter, and specifying SAR/PAR/DAR parameters is not needed. Since you are converting from SD to SD the ColorMatrix filter is also not needed.
Hope it helps...

Cheers
manolito

poisondeathray
10th October 2020, 01:19
4) De-interlacing needs to be done so used -vf yadif as one of 5 frames is duplicate.


That comment suggests it needs to be inverse telecined . Fieldmatched, decimated, to return 23.976. If it's a "movie" or film, this is likely the case


-vf "fps=30000/1001,fieldmatch,yadif=deint=interlaced,decimate"

bjoker
10th October 2020, 14:18
Thanks manolito & poisondeathray , will try them.

kolak
2nd February 2021, 14:33
bwdif is better than yadif and fast.