VideoHelp Forum

+ Reply to Thread
Results 1 to 10 of 10
  1. I have some DVDs that I want to encode with x264. Some of these DVDs have vertical black bars at the left and right of the image. One DVD has a black bar at the right, and no black bar at the left. One DVD has 4 pixel wide vertical black bars. Another DVD has 8 pixel wide vertical black bars. Another one has 12. Another has zero (no vertical black bars).

    I use the spline64 resizer in AviSynth to correct the aspect ratio. I don't want to correct it in the mkv container. And I don't want to upscale.

    The problem is that because of these vertical black bars, it is very confusing for me to figure out how to maintain the proper aspect ratio. I have two options: option 1 is to crop the vertical black bars, and option 2 is to not crop them.

    So I have these questions:

    1. If image is 16:9, and if I do not crop the vertical black bars, and I resize from 720x576 to 720x406, will aspect ratio be correct after resizing?
    2. If the answer for question 1 is "No", then it means I have to crop the vertical black bars before I resize, in order for the resized image to have the correct aspect ratio.
    Last edited by codemaster; 5th May 2021 at 13:41.
    Quote Quote  
  2. Kawaiiii
    Join Date
    May 2021
    Search Comp PM
    What do you use to encode it ?

    720 x 406 has a 16:9 aspect ratio, so you can simply specify it in the software you use to encode..
    Quote Quote  
  3. 720x576, PAL 25fps can be encoded to 720x404 to have an aspect ratio of 16:9; however, you can also keep the full 720x576 and still keep the aspect ratio of 16:9. In this case you have more pixels and therefore better quality.
    To achieve this, you must specify the desired DAR (display aspect ratio) when muxing, in this case 16:9, otherwise the aspect ratios in the display will be wrong.
    Quote Quote  
  4. This doesn't solve my problem. What would solve my problem is if I knew which of these two options are true:

    Option 1: On a DVD, the vertical black bars were layered on top of the 16:9 image, resulting in a width of 720 px.
    Option 2: On a DVD, the vertical black bars were appended at the right and left of the 16:9 image. This resulted in a width slightly greater than 720 px. Then the width was resized to 720 px, which caused the image to be a little bit less wide than 16:9.

    If option 1 is true, then I will not crop the vertical black bars, because aspect ratio is correct after resizing from 720x576 to 720x406 with spline64. But if option 2 is true, then aspect ratio is not correct after resizing to 720x406, because image is a little bit less wide than 16:9, and I should crop the vertical black bars before I resize, in order to restore the aspect ratio back to exactly 16:9.

    So this is my problem, that I don't know which of these 2 options is true. I need to know this first, so that I can then be able to have the correct aspect ratio after resizing. I suspect that option 2 is true, and option 1 is false, but I'm not sure, and I'm looking for some confirmation.
    Last edited by codemaster; 5th May 2021 at 11:00.
    Quote Quote  
  5. If Mediainfo shows an aspect ratio of 16:9 in your video and you have vertical bars on the right and left, this means that you have a video with an aspect ratio < than 1.777, e.g. 1.33, which is 4:3. Let's take a 4:3 video as an example.
    If you want to watch the video on a 16:9 TV, you can choose between two options when re-encoding:
    Either you encode the video 4:3 (540x404), or you encode the video 540x404 with 90 pixels of black padding left and right, for a total of 720x404. The video image information is the same in both cases.
    You will mux the first video as DAR 4:3 (in this case the black bars will be added by the TV), the second one as DAR 16:9.
    The view on the TV is the same for both.
    Quote Quote  
  6. Usually (DVD's made from ITU spec captures) the 720x480 NTSC frame should be cropped to 704x480 (702x576 PAL) and resized to a 4:3 frame, or have the DAR or SAR flagged so the player does the resizing at playback (beware that not all players respond to DAR/SAR flags so it's safer to resize). But some DVDs follow the MPEG2 spec where the entire 720x480 frame is the 4:3 picture. The former usually has obvious black borders, the latter no black borders. But not always.

    But the reality is you'll never notice the ~2 percent error if you do it the wrong way.

    This whole problem comes about because of the difference between the ITU spec (for capturing analog video) and the DVD/MPEG2 spec. I've written about this a million times and don't want to bother doing so again. Just search for some of my old posts.
    Last edited by jagabo; 5th May 2021 at 11:18.
    Quote Quote  
  7. way to Rigel 7 cornemuse's Avatar
    Join Date
    Mar 2014
    Cyber Dystopia
    Search Comp PM
    The 2 vert black bars are there to maintain the aspect ratio.
    If there are 2 vert and 2 horizontal bars, (what do ya call that, besides gutter-boxing?), now you can maintain aspect ratio, cropping up and down & left and right.
    I have quite a few movies like this, While I understand the process, I do not have the technical skills to do the cropping. Never needed this skill whilst operating bulldozers! Is there a 'gui' program to do this for idiots like me?

    Cranky Old Man
    Quote Quote  
  8. Originally Posted by cornemuse View Post
    The 2 vert black bars are there to maintain the aspect ratio.
    If there are 2 vert and 2 horizontal bars, (what do ya call that, besides gutter-boxing?), now you can maintain aspect ratio, cropping up and down & left and right.
    I have quite a few movies like this, While I understand the process, I do not have the technical skills to do the cropping. Never needed this skill whilst operating bulldozers! Is there a 'gui' program to do this for idiots like me?

    You could try my clever FFmpeg-GUI. It has an automatic crop detect system.
    Image Attached Thumbnails Click image for larger version

Name:	1.jpg
Views:	19
Size:	112.0 KB
ID:	58747  

    Last edited by ProWo; 6th May 2021 at 10:18.
    Quote Quote  
  9. Member DB83's Avatar
    Join Date
    Jul 2007
    United Kingdom
    Search Comp PM
    Try loading a video in to handbrake. The default process is to automatically crop away letterbox and pillarbox bars.

    But if I read you right you want the best of both worlds. Remove the bars and retain the aspect ratio. Try the program with a small sample to see how it works for you (but you will need a square pixel output and full screen playback will still result in black bars unless you have a precise 16:9 height/width ratio)

    BTW your 'gutterboxing' is more commonly known as non-anamorphic wide-screen.
    Quote Quote  
  10. codemaster,
    you can also try the Avisynth CropResize function in my signature. There's pictures illustrating how to use it in the second post if you follow the link. You can use it with a GUI such as AvsPmod if you wish to. AvsPmod also has it's own cropping abilities with a preview. I sometimes determine the required cropping with it first (or using MeGUI's script creator), then do the actual cropping and resizing with CropResize.

    For the most straightforward usage you can simply specify the desired output width (specify zero for the height) any cropping required to remove the black from the sides and/or top or bottom, and let the script do the rest.

    For DVDs I recommend the following......
    In order for the script to resize correctly (to non-anamorphic dimensions) you have to specify the DVD's aspect ratio as an input display aspect ratio for CropResize to base it's calculations on (or as an input sample aspect ratio).

    For 4:3 DVDs I'd recommend choosing between InDAR=4.0/3.0 and InDAR=15.0/11.0. Actually that's not quite correct. For 4:3 DVDs I always use InDAR=15.0/11.0

    For 16:9 DVDs, choose between InDAR=16.0/9.0 and InDAR=20.0/11.0. If there's a lot of crud down the sides or the source was originally analogue video, use 20:11, otherwise most newer 16:9 DVDs are exactly 16:9 (in my opinion).

    The difference is.... an input DAR of 16:9 assumes the entire width, including any black before cropping, should be used for an exact 16:9 display aspect ratio. An input DAR of 20:11 assumes only 704 pixels of the width should be used for an exact 16:9 aspect ratio. 704x480 for NTSC or 704x576 for PAL. The additional 16 pixels should either be cropped away, or if they remain, they'd make the entire image slightly wider than 16:9 (20:11 without cropping).

    The above applies to both PAL and NTSC DVDs. I'd also recommend trying the CropResize "ResizeWO" option (resize width only). It prevents the script resizing the height and therefore it only resizes the width for the correct aspect ratio, but that's up to you. If you do so, you can specify zero for both the output width and height. As I said, there's pictures illustrating CropResize usage if you follow the link in my signature, but here's a quick example for you. There's also black bars top and bottom that require cropping, although obviously that isn't always the case

    A (fake) 16:9 NTSC DVD.

    [Attachment 58817 - Click to enlarge]

    As there's a reasonable amount of black down each side, I'll use InDAR=20.0/11.0 rather than InDAR=16.0/9.0, and enable the cropping preview to adjust the cropping. In this case it requires 12 pixels from the left, ten from the right, and 62 from both the top and bottom to remove all the black.

    CropResize(0,0, 12,62,-10,-62, ResizeWO=true, InDAR=20.0/11.0, Resizer="Spline64Resize", CPreview=1)

    [Attachment 58818 - Click to enlarge]

    Once you're happy with the cropping, simply remove the CPreview argument or change it to CPreview=0. By default the output width and height will be mod4, unless you don't use ResizeWO=true and specify an output width or height yourself, in which case they'll be whatever you specify.

    CropResize(0,0, 12,62,-10,-62, ResizeWO=true, InDAR=20.0/11.0, Resizer="Spline64Resize")

    [Attachment 58819 - Click to enlarge]

    To specify an output width of 720 pixels, while letting the script take care of the height.

    CropResize(720,0, 12,62,-10,-62, InDAR=20.0/11.0, Resizer="Spline64Resize")

    [Attachment 58820 - Click to enlarge]

    As I said, for 16:9 DVDs, the InDAR choices are 20:11 or 16:9. Mostly it'll be the latter, but if there's a lot of black each side use the former. There's no way to automatically know for certain which is correct though, so if in doubt, use whichever InDAR you think looks right. The difference isn't huge anyway. If you can find a straight on shot of an object you know should be perfectly round or perfectly square, use it to determine which InDAR looks correct to you after resizing with the script, otherwise I go with the rule of thumb I mentioned previously.

    The one exception to my rule of thumb would be any 16:9 DVDs from the BBC. I'm pretty sure they're always 20:11 whether there's black down the sides or not. Technically, I think the BBC uses it's own standard which resizes slightly wider than 20:11, (1050:576 for PAL, I think) but it's only be a couple of pixels wider than 20:11, so 20:11 is close enough.

    If you don't want to crop yourself, try auto-cropping. If it doesn't crop all the black or crop cleanly, you can specify a little extra copping yourself if need be. The AutoCrop plugin is required. There's a link in the CropResize help file.

    CropResize(720,0, AutoC=true, InDAR=20.0/11.0, Resizer="Spline64Resize")

    Here's the difference for this particular DVD if you cropped exactly the same amount of black, but specified 16:9 as the InDAR.
    When ResizeWO=true the height doesn't change, so the width resizing becomes slightly narrower than for InDAR=20.0/11.0

    CropResize(0,0, 12,62,-10,-62, ResizeWO=true, InDAR=16.0/9.0, Resizer="Spline64Resize")

    [Attachment 58827 - Click to enlarge]

    Or when resizing the width to 720 and letting CropResize take care of the height. As the output width is 720 as before, but the input DAR is a little narrower than 20:11, the resized height is slightly greater.

    CropResize(720,0, 12,62,-10,-62, InDAR=16.0/9.0, Resizer="Spline64Resize")

    [Attachment 58828 - Click to enlarge]
    Last edited by hello_hello; 26th May 2021 at 19:14.
    Quote Quote  

Similar Threads