Greeting Folks,
I'm having trouble to obtain correct DAR when encoding my old NTSC full frame 4:3 DVD into x264. DVD has letterboxing so I want to remove letterboxing and keep original aspect ratio 4:3 to watch on PC as well on TV through USB drive. I tried anamorphic (overcrop to achive selected mode) option in Megui to avoid any resizing but then I get very weired aspect ratio 5:3. When I crop video I get 718x386 resolution and then get 5:3 DAR after encoding in Megui by using anamorphic option. So I please suggest me what should I do in order to achieve correct aspect ratio. So basically I have three question:
1- Do I have to add letterboxing to get correct DAR ? If yes, then please suggest me least letterboxing pixels I need to add.
2- My video is telecine interlace so what method should I use to deinterlace it ? For test purpose I used below Avisynth script to deinterlace it and result seems good.
But let me know if there is any other method would be more feasible?Code:AssumeTFF() TFM(d2v="Sample2.d2v", clip2=QTGMC(Preset="Medium").SelectEven()).TDecimate()
3- I am also confused in correct PAR. AvsPmod shows 8:9 when I computed it through d2v file so I used 8:9 in x264 settings, is that correct sar ?
I've attached few secs clip cut from DVD, so please advise me how to get maximum quality, I want to keep as much as details I can.
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 1 to 16 of 16
Thread
-
-
I've just looked at your sample. It's stored at a resolution of 720 * 480 px (3:2).
When it plays, then it's shown (correctly) in 4:3, i.e. at 720 * 540 px. So, if you want to have the result in 4:3 you should leave the blackbars as they are.
Suggestion for encoding:
Code:ffmpeg -i Sample2.demuxed.m2v -r 30000/1001 -aspect 4:3 -vf yadif,scale=720:540 -c:v libx264 -preset fast -crf 18 -an -y sample_264_4-3.mp4
Suggestion for encoding:
Code:ffmpeg -i Sample2.demuxed.m2v -r 30000/1001 -aspect 5:3 -vf yadif,scale=720:540,crop=720:432:0:54 -c:v libx264 -preset fast -crf 18 -an -y sample_264_5-3.mp4
I'll attach the results. -
Thank you fornit for replying me. I have few questions. I am not an expert so I am not able to understand this.
I've just looked at your sample. It's stored at a resolution of 720 * 480 px (3:2).
If you want to remove the blackbars, then you will get an aspect of 5:3
I hate letterboxing so i decided to keep DAR 5:3 if I have to but no letterboxing.
I also see you didn't pass any -sar paramater? isn't that important to play on TV?Last edited by sameerkool25; 9th Jul 2018 at 06:30.
-
Storage aspect ratio simply follows from the number of pixels. If you look at your sample with the help of MediaInfo, you'll notice a width of 720 and a height of 480 px:
720/480=1,5=3:2
The display aspect ratio is 4:3 here. This tells the player to stretch height from 480 to 540 px to display the video correctly. Because 720/540=1,333333=4:3. This means: Pixels are not square.
The DAR of 5:3 is the result of a little math: Video is displayed at 720 * 540 px. Blackbars have a height of 54 px, so there are 720 * 432 px remaining for the video. 720/432=1,666667=5/3.
The result of the conversion is a video with square pixels. In that case DAR = SAR. Usually that makes things much easier for video players.
But please try the samples on your TV. 5:3 is a format which is not that usual. If that doesn't work maybe some additional switches can help. -
The display aspect ratio is 4:3 here. This tells the player to stretch height from 480 to 540 px to display the video correctly. Because 720/540=1,333333=4:3. This means: Pixels are not square.
-
Usually pixels are stretched in horizontal direction, but interestingly it's vertical here.
638 * 480 px (or better 640 * 480 px) would lead to a correct display aspect ratio, too, but then pixel information would get lost, that is physically available.
Please try your sample with VLC player. You'll notice that it plays it at 720 * 540 px. -
Ok I saw that height is stretched to 540px in VLC. I had to take a snapshot of sample to check stretched height.
One more thing.
The DAR of 5:3 is the result of a little math: Video is displayed at 720 * 540 px. Blackbars have a height of 54 px
Please bear me with questions as this is very confusing with these shitty old dvds. I never had any problem with BluRays. -
The principle hasn't been much different from your approach. I've taken a snapshot of a frame with bright colours so that top and bottom of the video could be clearly identified.
I've then tried some transparent rectangles with a fixed aspect as video overlays and I've found that 5:3 seems to fit quite good. The rest has been a bit of math again ...
If you want something like a "pixel perfect fit" for this specific video, then you can invest more work:- For analysis (only) encode it with the storage aspect ratio as display aspect ratio (i.e.: set aspect to 3:2 instead of 4:3)
- I've just done that, encoding string will then be Code:
ffmpeg -i Sample2.demuxed.m2v -r 30000/1001 -aspect 3:2 -vf yadif -c:v libx264 -preset fast -crf 18 -an -y sample_264_3-2.mp4
- The video will then look a bit stretched when you view it with VLC because it's a wider aspect than intended. -> see attachment
- Then take a snpashot with bright colours and look at the number of pixels of blackbars, black pixels at the left and at the right.
- Then change the encoding string so that the cropping is done before the scaling. To get your sample "pixel exact" I've found: Blackbars of 47 px at the top and at the bottom, no black pixels at the left, 2 black pixels at the right (i.e.: a width of 718 px instead of 720).
- This leads to a crop statement as follows: -vf crop=718:386:0:47. (Note: 386 + 2 * 47 = 480 px)
- Then scale it up to 5:3, i.e.: to 720 * 432 px. Because that's obviously the aspect intended by the producers of the video. The final encoding string will then result to: Code:
ffmpeg -i Sample2.demuxed.m2v -r 30000/1001 -aspect 5:3 -vf yadif,crop=718:386:0:47,scale=720:432 -c:v libx264 -preset fast -crf 18 -an -y sample_264_5-3v2.mp4
But if you want to convert many videos and blackbars and/or pixels at the left and at the right differ a bit from video to video then I'd suggest not to invest that work for each video and to use the statement above shown in my first post.Last edited by fornit; 9th Jul 2018 at 19:02.
-
Your source is 720x480 4:3 DAR which means it's 8:9 SAR. Crop whatever you like and encode 8:9 SAR and you will get the right DAR.
If you prefer square pixel encoding, resize to any 4:3 frame size, then crop whatever you like. The remaining image will have the correct DAR. -
I've written above "The result of the conversion is a video with square pixels. In that case DAR = SAR. Usually that makes things much easier for video players."
In "ancient times" video encoding has required techniques which have made encoding more complex. If you suggest a SAR of 8:9 this would mean not to have DAR=SAR=1:1. Why do you want to keep that complexity of old days?
That's exactly what I have proposed. Sorry, but I don't understand why you emphasize that.Last edited by fornit; 9th Jul 2018 at 20:00. Reason: typo
-
Yes, 8:9. No matter how you crop it, the SAR is always 8:9.
But let me know if there is any other method would be more feasible?
I think the argument can be made that by encoding with the 8:9 SAR the resulting quality will be better because no resizing is done during the encode. And there's nothing obsolete about using a SAR to get the correct aspect ratio, rather than doing a resize into square pixels.
I don't believe jagabo was contradicting you, but just proposing an alternative (and perhaps better) method. In addition, my own opinion is that you made the whole explanation unnecessarily difficult to understand and it's little wonder sameerkool25 asked followup questions. -
I agree with manono & jagabo. Every lossy generation added loses quality. But so do interpolative/extrapolative resizes, even when using lossless encoding.
Look at it this way: in the original rip, what percentage of pixels are the original, ground truth pixels (as decoded)? - 100%.
In a non-resized lossy re-encode, barring a few percent that change due to dct re-blocking and possible color subsampling adjustments, they are the same pixels. So, close to 100%.
In a 2:1 resize, your original pixels now amount to only 50% of the total. And that's one of the special cases - it would normally likely include an even higher percentage of guessed-at, newly synthesized pixels.
Why would that be considered truer to the original, just because it's easier math for your visual understanding?
Scott -
Your source is 720x480 4:3 DAR which means it's 8:9 SAR. Crop whatever you like and encode 8:9 SAR and you will get the right DAR.
If you prefer square pixel encoding, resize to any 4:3 frame size, then crop whatever you like. The remaining image will have the correct DAR. -
Starting with the 720x480 frame:
Cropping 44 lines off the top, 48 lines off the bottom leaves 720x388:
Code:DAR = FAR * SAR DAR = 720:388 * 8:9 DAR = (720/388) * (8/9) DAR = 1.649
Code:DAR = FAR * SAR DAR = 640:388 * 1:1 DAR = (640/388) * (1/1) DAR = 1.649
-
I'm not sure whether really nothing is obsolete keeping it anamorphic. I've just tested an anamorphical x264 encode on the mobile devices, I've lying around here in my office.
On the iPad it plays fine.
On my older Samsung S5 (Android 6.0.1) it is squeezed when opened with the standard player.
On my newer Android device (7.1.1) it starts squeezed for a second but is then corrected to the right dimensions. But if a pause the video, switch to another application and back, then it's squeezed, too. And I must restart it to get the correct dimensions again.
I've then tried to "beam" it to my TV with Google Chromecast. Again it appeared squeezed.
This is far away from a broad research. And of course there is a lot of video players that can be installed on mobile devices. But isn't it fine if things work out of the box? -
Yes, not all devices display anamorphic encodes properly. On the other hand, resizing always has the possibility of creating artifacts.
Similar Threads
-
Different DAR between Mediainfo and DGIndex
By tppytel in forum Video ConversionReplies: 8Last Post: 30th Sep 2017, 11:50 -
Capturing TV broadcast 4:3 and 16:9 DAR
By wiseant in forum CapturingReplies: 8Last Post: 22nd Jan 2017, 14:20 -
change DAR 16:9 TO 2:35:1
By anime12345 in forum Video ConversionReplies: 7Last Post: 31st Aug 2015, 16:04 -
DAR confusion
By adom in forum Newbie / General discussionsReplies: 4Last Post: 24th Aug 2014, 23:50 -
sar dar x264vfw
By marcorocchini in forum Newbie / General discussionsReplies: 1Last Post: 11th Aug 2014, 20:02