2

I'm confusing myself over how the video filters work, particularly how they work together, I think. I have two MKVs, pulled from DVD, that are respectively 16:9 and 4:3. What I would like to do is ultimately combine them (mkvmerge widescreen.mkv + fullscreen.mkv) and to do that I need matching display aspect ratios.

So I would like to pillarbox the 4:3 video as I encode it, and then hopefully append it to the 16:9 video. I've tried a number of filters to accomplish this, and the closest I was able to get was a slightly wider than expected video, otherwise pillarboxed properly.

ffmpeg -i fullscreen.mkv 4:3 -vf "pad=853:480:66:0,scale=720x480,setdar=16:9" [etc.]

The pixel dimensions are 720x480, the display dimensions are 853x480, and the two MKVs can be successfully merged (after reencoding the widescreen.mkv to the same video codec, but without video filters).

However, the resulting display of the fullscreen video is pillarboxed, yet slightly horizontally stretched. In 1:1 pixels it measures 720px across, not 640.

I figure I'm doing the math wrong, or misunderstanding how the filters are supposed to operate, or something simple, but my understanding of ffmpeg video filters is basically nothing.

1

Assuming both MKVs are rips of NTSC DVDs, these are the commands you need:

For 4:3 video

ffmpeg -i "input43.mkv" -vf "scale=640x480,setsar=1,pad=854:480:107:0" [etc..]

For 16:9 video

ffmpeg -i "input169.mkv" -vf "scale=854x480,setsar=1" [etc..]

(Note H.264, the codec you are likely using, needs dimensions to be even, so specifying 853 as width will lead to ffmpeg feeding 854 pixels to the encoder and then auto-setting a funky SAR.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.