ffmpeg .mpg to DVD (via DVDAUTHOR) 4:3 aspect ratio wrong

0

I have tried to get a 4:3 aspect ratio correct for DVD-TV presentation, but nothing seems to get it right. So, I made a TEST 448x336 px T.MKV movie that has a white background and two squares of different colors inside. The MKV movie shows perfect squares and 72x72ppi-GIMP, but the Test.mpg square (72x81ppi) authored by DVDAUTHOR on the DVD is off. The 336px square is off 14.5"x13.5" on a 42" widescreen lcd TV display / Sony Blu-Ray player. The 10/11 scale filter is the closest, but it is still off. Code snippet follows:

ffmpeg BLAH -f dvd -target ntsc-dvd -filter:v "fps=30000/1001,scale='w=min(448,trunc((336*10/11*dar)/2+0.5)*2):h=min(336,trunc((448*11/10/dar)/2+0.5)*2)',pad='w=720:h=480:x=(ow-iw)/2:y=(oh-ih)/2',setsar='r=10/11'" -pix_fmt yuv420p -q:v 0 BLAH T1.MPG

The 4:3 standard way is way off. TV displays about 15.25"x12.625". Code snippet follows:

ffmpeg BLAH -f dvd -target ntsc-dvd -aspect 4:3 -filter:v "fps=30000/1001,scale=448:336,pad=720:480:136:72:black" -pix_fmt yuv420p -q:v 0 BLAH T2.MPG. 

My goal is to get a 448x336 px, 4:3 aspect movie with the correct size and centered on the TV display. Any help would be greatly appreciated.

Kendo2

Posted 2015-10-08T20:17:18.863

Reputation: 1

Answers

0

Compensate for TV overscan = 5% (typically) on a 16:9 aspect ratio video to —> NTSC DVD:
SAR × PAR = DAR
(SAR) storage aspect ratio is the ratio of width to height (in pixels) of the stored image or video.
(PAR) pixel aspect ratio is the aspect ratio of a single pixel in a stored image. In video, pixels are not always square. When non-square, the width typically uses more pixels (PPI) than the height, which is usually 72 ppi.
(DAR) is your display aspect ratio usually 4:3 or 16:9 -- this case. A 720x480 (SAR 3:2, and a 16:9 DAR is a given. The PAR is then calculated: DAR/SAR=PAR or 16/9/(3/2)=16/9x2/3=1.185185... The reciprocal of 1/1.185185...=0.84375. As it turned out, ffmpeg uses different notations. The SAR as seen in ffprobe is really the PAR. In any case, the typical notation for PAR (called SAR by ffmpeg) is normally shown as "sample_aspect_ratio": "32:27". 32/27=1.185185...

An anamorphic (85.3333:72 pixels (non-rectangular) DVD video PAR=32/27 with a 16:9 display aspect ratio (DAR), movie will not fit on your TV screen properly if taken from a perfect 16:9 format. You will lose 5% due to overscan. Most commercial DVD's do not compensate for this fact. Don't tell Hitchcock that. So, if you have a 1280:720 or 1920:1080 (i) source, you can either scale + pad it first by 0.95*1280:720=1216:684 and pad it to 1280:720, then re-encode using the default -s 720:480 ffmpeg -target ntsc-dvd parameters OR scale once. Code snippet follows:

-filter_complex "[0:v]setpts=PTS-STARTPTS,scale='w=min(684,trunc((456*27/32*dar)/2+0.5)*2):h=min(456,trunc((684*32/27/dar)/2+0.5)*2)':flags=lanczos+accurate_rnd+full_chroma_inp,pad='w=720:h=480:x=(ow-iw)/2:y=(oh-ih)/2',setsar='r=32/27',fps=30000/1001"

This scaling concept will get your video to exactly fit on your 16:9 TV screen -- without re-encoding! The '40/33' example often seen is nice but is not meant to be used in this case.

Kendo2

Posted 2015-10-08T20:17:18.863

Reputation: 1

This is more complicated than it needs to be. In the notional width of 720, there are 704 active pixels in NTSC. And the NTSC standard pixel aspect is 10/11, which makes for a 640x480 display output. So, 448x336, if it's meant to be displayed full screen, should be scaled to 704x480, then padded to 720x480 and finally setdar=4/3 set. – Gyan – 2016-09-01T06:53:40.047

0

I answered my own question for this specific video. My large 336px square is square on my TV. 10/11 was too wide in width and 9/11 was too narrow in width. The height is locked or the same. So I measured an answer on the TV, but I do not know about other TV/DVD player combos. I also do not know the formula to be successful for all padded or non-padded videos, other aspect ratios and scaling issues. When time permits, would someone please answer with math? Code snippet follows:

ffmpeg FOO -f dvd -target ntsc-dvd -filter:v "fps=30000/1001,scale='w=min(448,trunc((336*8453/10000*dar)/2+0.5)*2):h=min(336,trunc((448*10000/8453/dar)/2+0.5)*2)',pad='w=720:h=480:x=(ow-iw)/2:y=(oh-ih)/2',setsar='r=8453/10000',setdar='dar=4/3'" -pix_fmt yuv420p -q:v 0 FOO T(8453-10000).mkv

Kendo2

Posted 2015-10-08T20:17:18.863

Reputation: 1