Log in

View Full Version : HandBrake conversion - cropping/resizing help!


Jonny_R
14th April 2011, 14:23
Hi,

I have transferred some old (interlaced) VHS tapes to DVD (via a DVD/HDD recorder). These are PAL format. The VOB/MPEG2 video size is 720 x 576 (5:4) and are for display at 4:3 ratio (on TV).

I have done some trial conversions using HandBrake (Windows) to convert to MPEG4 AVC (video)/AAC (sound track) and these are successful but...

If I trim the rough black borders (poor VHS) the video size is reduced to 684 x 554 (so sits between 5:4 and 4:3). Fundamentally the pixel ratio (if that's the right term) remains at 5:4 as the video image has only been cropped. It seems to me if I do this (the crop) there is no way to record/register that the image actually has a 5:4 source format. Do I rely on resizing the image during conversion to a 4:3 ratio so it is then implicit in the H x V size ratios? Or, do I not resize and somehow just set the height/width/PAR values appropriately (and 'Keep Aspect Ratio') to get the video to display correctly at 4:3?

I'd appreciate if someone can advise and provide the numbers/settings I should use (and include the maths so I understand for future reference. I have tried a couple of options (with no re-size) and the video seems to be displaying at approx 5:4 in Windows media classic even though when I inspect the file via MediaInfo the video stream says 684 x 554 (4:3), however, any reference to the source being 5:4 appears to be lost.

I have looked at the HandBrake help and I am more confused! SARs, PARs & DARs!

FYI, I am encoding using VBR at 2500kbps that produces good quality output. When I tried constant quality (CQ = 20) the quality was comparable but the filesize was x3!

I have set ref frames to 3 and B frames to 3. I understand what a ref frame is but not a B frame, anyone? Are 3 & 3 appropriate values for these settings? - I can't say I have the time (conv very slow on my old laptop) or experience to determine otherwise. I am archiving these old videos for reference.

Many thanks, Jonny

Jonny_R
14th April 2011, 14:39
I also forgot to ask, is it critical to have the image height & width divisible by 16? I've read this in several sources & posts. HandBrake didn't complain about my 684 x 554 dimensions and I appear to have a quality result.

sneaker_ger
14th April 2011, 14:57
Set Handbrake to "strict" anamorphic and it should do the math for you. The reason it is displayed correctly, while mediainfo says it's 684 x 554, is rather simple: Handbrake encodes the video with 684 x 554 pixels, but it adds a flag for the player that tells it to resize the file to the correct aspect ratio on playback.

To B-frames:
An I frame is completely independent (like a jpeg picture)
A P frame uses information from preceding pictures
A B frame uses information from both preceding and following pictures

3 & 3 are okay, more means better quality at the same bitrate but the quality doesn't increase linearly and compatibility and encoding time get worse.

sneaker_ger
14th April 2011, 14:58
I also forgot to ask, is it critical to have the image height & width divisible by 16?

No, internally H.264 works with mod16 resolutions, but the end user doesn't have to worry about that.

Gavino
14th April 2011, 16:27
I have transferred some old (interlaced) VHS tapes to DVD. ... The VOB/MPEG2 video size is 720 x 576 ... If I trim the rough black borders (poor VHS) the video size is reduced to 684 x 554
Cropping an interlaced MPEG2 source at the top or bottom must be done in multiples of 4.

Jonny_R
15th April 2011, 10:48
Thanks guys, I'll try the strict anamorphic - and adjust the cropping by 2 pixels.

Do I need to tick 'Keep Aspect Ratio' or will that defeat the purpose?

I've attached a screenshot of my proposed settings.

Original VOB/MPEG2 is 720 x 576. Crop settings are now L14, R22, T10, B14 that reduces the image to 684 x 552.

With 'Strict' Anamorphic on, HandBrake says the Width = 720 & Height = 544. If I increase the cropping values H & W don't actually change any further. If I then switch to 'None' Anamorphic the H & W do then adjust automatically and the values are locked in when I again switch to 'Strict' Anamorphic. This appears to be a bug? Display size is 730 x 552 with 'Strict' Anamorphic on (when Width = 720 & Height = 544 and cropping as stated & 'Keep Aspect Ratio' is on) - I'm not sure how those numbers are arrived at?!

Finally, does 'Height' & 'Width' refer to the actual image dimensions of the encoded video or will the image dimensions of the encoded video actually be the cropped (source) size of 684 x 552 (so no 'resizing' other than being cropped)?

Thanks, Jonathan

Edit remark: Your pic is way too big (in resolution). Make it smaller or upload it somewhere else and give a link.

Gavino
15th April 2011, 20:37
Cropping an interlaced MPEG2 source at the top or bottom must be done in multiples of 4.I'll ... adjust the cropping by 2 pixels.
...
Original VOB/MPEG2 is 720 x 576. Crop settings are now L14, R22, T10, B14 that reduces the image to 684 x 552.
What I meant was that both top and bottom crops must be multiples of 4, not just their sum. Otherwise the chroma pixels will be associated with the wrong field.

Jonny_R
21st April 2011, 15:26
Thanks all. I think I have it sussed now.

Original source PAL DVD 720 x 576 (5:4) now cropped by L16, R24, T8, B16 that reduces the image (Width x Height) to 680 x 552.

PAR Height = 552
PAR WIDTH = 552 x 4 / 3 = 736

I realised the 'Keep Aspect Ratio' is for internal HandBrake use - I thought this was a setting that was encoded as well for use by the target media player!