View Single Post
Old 9th September 2017, 02:09   #7  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,823
Quote:
Originally Posted by ogrgkyle View Post
hello_hello - Ah, thanks for clarifying how my script wasn't working. So why is DGIndex/MPEG2Source a better option?
It's been around a long time and as close to 100% reliable as you can get for mpeg1/2, plus by default it obeys pulldown flags, whereas ffms2 ignores them, and that can lead to frame rate and audio sync problems unless you know to use rffmode=1.

Quote:
Originally Posted by ogrgkyle View Post
For instance, I see less than 16 pixels of the width of this particular MPEG can be cropped, but that may be because I'm cropping after scaling. What I'm doing is converting to square pixels then cropping like so: Crop(6, 4, 628, 474, align=False). I was wondering though, given that the original width is 720, is it the best strategy to scale to 640? What if instead I scaled the height to 540?
There's no guarantee there'll be exactly 8 pixels of black each side, sometimes it's a lot more, and sometimes there's almost none.

In theory at least, the best quality method is to crop and not resize at all, but set the correct pixel aspect ratio when encoding and let the player resize it on playback as it would for the original mpeg2/DVD video.
Next best would be to crop and only resize the width for the correct aspect ratio, while third best is resizing the height and/or width.
NTSC 4:3 DVDs are the only type of DVD that require reducing the width when resizing to square pixel dimensions, so that could be an argument for increasing the height instead, but I doubt it'd make a difference to picture detail. I usually go with 624x468 for 4:3 NTSC as it's exactly 4:3 and if you're also cropping a few pixels top and bottom, which I invariably do, after cropping you're not reducing the height by much. It's personal preference though....

I use the third best method nearly all the time because IMHO the the quality difference is largely theoretical, because I like to resize a bunch of related videos to the same resolution after cropping, because I'm OCD about cropping to exactly 4:3 or 16:9 if the source is close to those aspect ratios, and because the media player in my TV doesn't support anamorphic MKVs/MP4s (video with non-square pixels) and displays them incorrectly, so I always resize to square pixel dimension when encoding.

If you're just cropping the black and don't care about the final aspect ratio it doesn't matter which order you do it in, but if you want to control the output dimensions it's easier to do it the other way around because you can crop to a specific aspect ratio such as 4:3, and then resize to whatever 4:3 dimensions you prefer.

The resize filters also crop as the Crop() filter does, although for cropping the black it's probably better to use the cropping filter before resizing (see the info just above "Examples" here) however the resize filters aren't restricted to mod 2 cropping.
As an example, this would crop 10 pixels from the left, 9 from the right, and 2 from the bottom, and for a 4:3 NTSC DVD that'd give you an aspect ratio of 1.3332 so you could resize to any 4:3 dimensions with virtually zero aspect error.

Crop(10, 0, -8, -2) # or Crop(10, 0, 702, 478)
BicubicResizeMT(640, 480, 0, 0, -1, 0)

How you do it is personal preference of course, but if you want to try that method have a play with this calculator:
YodaResizeCalculator 0.4.0.1
As a rule of thumb, select "mpeg4" as the PAR Spec for 4:3 DVDs and "Generic" for 16:9 DVDs.

Last edited by hello_hello; 9th September 2017 at 02:25.
hello_hello is offline   Reply With Quote