VideoHelp Forum

+ Reply to Thread
Results 1 to 27 of 27
Thread
  1. hi, I have a PAL DVD which I'm trying to encode.
    The DVD has the typical resolution of 720x576 but, when I play it with MPC-HC, I'm not sure how to explain it correctly,
    it displays with a 4:3 AR, so it displays a res of 768x576.
    Then I crop it in avsPmod with the line "crop(6,76,-10,-74)", so the resulting resolution becomes 704x426.
    Now I want to resize it by using the "--sar x,y" option in MeGUI and using the 16:15 ratio results in a res of 750x426.
    This resolution is almost correct but differs from the one that I expect that is 752x426.
    This is why I can't figure out what is the correct "x264 --sar x,y" values I have to use.
    pls help.
    Quote Quote  
  2. 16:15 seems correct, it will stretch the image during play to 751x426.
    Quote Quote  
  3. Capturing Memories dellsam34's Avatar
    Join Date
    Jan 2016
    Location
    Member Since 2005, Re-joined in 2016
    Search PM
    Could you post a frame grab of the original video? Cropping off 150 pixels seem to be wrong, Is there any picture left at all?
    Quote Quote  
  4. Originally Posted by dellsam34 View Post
    Could you post a frame grab of the original video? Cropping off 150 pixels seem to be wrong, Is there any picture left at all?
    sure, here is:
    https://www.dropbox.com/sh/epvle2iip8am9yi/AACx-Vbe1ayYsNTv8A3VydVja?dl=0
    Quote Quote  
  5. Capturing Memories dellsam34's Avatar
    Join Date
    Jan 2016
    Location
    Member Since 2005, Re-joined in 2016
    Search PM
    No, a picture grab from the video with the original resolution, You took snap shots of the program. Still cropping horizontally is totally wrong, You only need to crop vertically and resize accordigly to the new AR which I could calculate if you provided an original frame not the software window.

    Play the DVD in VLC or MPC-HC and go to menu and take a snapshot and post it here using the forum attachment tool, not a third party file host.
    Quote Quote  
  6. Originally Posted by maudit View Post
    hi, I have a PAL DVD which I'm trying to encode.
    The DVD has the typical resolution of 720x576 but, when I play it with MPC-HC, I'm not sure how to explain it correctly,
    it displays with a 4:3 AR, so it displays a res of 768x576.
    Then I crop it in avsPmod with the line "crop(6,76,-10,-74)", so the resulting resolution becomes 704x426.
    Now I want to resize it by using the "--sar x,y" option in MeGUI and using the 16:15 ratio results in a res of 750x426.
    This resolution is almost correct but differs from the one that I expect that is 752x426.
    768 * 704 / 720 = 750.93333... MeGUI rounded to the nearest mod 2 frame size.
    Quote Quote  
  7. Originally Posted by dellsam34 View Post
    No, a picture grab from the video with the original resolution, You took snap shots of the program. Still cropping horizontally is totally wrong, You only need to crop vertically and resize accordigly to the new AR which I could calculate if you provided an original frame not the software window.

    Play the DVD in VLC or MPC-HC and go to menu and take a snapshot and post it here using the forum attachment tool, not a third party file host.
    the folder I've linked contains:
    - avsPmod ss - in order to show the crop line and the resultant res of 704x426
    - a DVD ss taken from MPC-HC whose res is 768x576
    - the same DVD ss manually cropped in order to show the expected resolution - 752x426
    - a ss from the encode file using SAR 16:15 - with a res of 750x426

    - added just now another avsPmod ss uncropped with 720x576 res
    - added the ss of the utility I've also used to calculate the anamorphic resize horizontal res.
    Last edited by maudit; 25th Dec 2021 at 18:09.
    Quote Quote  
  8. Originally Posted by jagabo View Post
    Originally Posted by maudit View Post
    hi, I have a PAL DVD .....
    This resolution is almost correct but differs from the one that I expect that is 752x426.
    768 * 704 / 720 = 750.93333... MeGUI rounded to the nearest mod 2 frame size.
    I don't fully understand this formula but it has sense.
    So can I change something in order to let MeGUI to round to the nearest mod4?
    Quote Quote  
  9. Capturing Memories dellsam34's Avatar
    Join Date
    Jan 2016
    Location
    Member Since 2005, Re-joined in 2016
    Search PM
    Could you upload few seconds of the VOB file so I can do some math in avspmod? What is your target screen format for viewing? 16:9 or 4:3, If 4:3 then leave it alone or resize it to 1440x1080, If 16:9 than a math has to be done on the original frame including any black borders on all 4 sides.
    Last edited by dellsam34; 25th Dec 2021 at 20:01.
    Quote Quote  
  10. Capturing Memories dellsam34's Avatar
    Join Date
    Jan 2016
    Location
    Member Since 2005, Re-joined in 2016
    Search PM
    Okay your active video area is roughly 706x426 assuming it is consistent through out the video, But the frame looks like it is squeezed horizontally a little bit judging by the human heads. But lets assume it is not for now, so your frame in a 16:9 aspect ratio will have black pillars added on both sides of approximatly 52 pixels each, then resize to 1920x1080 to get a legal resolution, If your frame is indeed squeezed then resizing without adding black pillars will get you a perfect 16:9 frame:



    Image Attached Thumbnails Click image for larger version

Name:	1920-1080 Resize.png
Views:	471
Size:	3.70 MB
ID:	62545  

    Click image for larger version

Name:	Resize 2 1920-1080.png
Views:	469
Size:	3.80 MB
ID:	62546  

    Last edited by dellsam34; 25th Dec 2021 at 21:22.
    Quote Quote  
  11. Originally Posted by maudit View Post
    I don't fully understand this formula but it has sense.
    Another way to look at it. Your new image is 704 pixels wide. With a SAR of 16:15 it becomes 704 * 16 / 15 = 750.933333... pixels wide.

    Originally Posted by maudit View Post
    So can I change something in order to let MeGUI to round to the nearest mod4?
    I believe it has a modulus setting in the resize settings.

    Beyond that you have the fact that many DVDs made from video tape are captured with the rec.601 specification where a 704x576* portion of the frame contains the 4:3 image. The extra 16 pixels are padding. So the SAR is really 12:11.

    And Delsam34 may be right. It looks like there's something wrong with the aspect ratio of the video. Look for something of known aspect ratio in the video and use that as a guide.


    * It's actually closer to 702x576 but most programs use 704 because it's a nicer number.
    Last edited by jagabo; 25th Dec 2021 at 22:22.
    Quote Quote  
  12. Originally Posted by dellsam34 View Post
    Could you upload few seconds of the VOB file so I can do some math in avspmod? What is your target screen format for viewing? 16:9 or 4:3, If 4:3 then leave it alone or resize it to 1440x1080, If 16:9 than a math has to be done on the original frame including any black borders on all 4 sides.
    I don't know how to cut vob files, so I upload the last small one.
    https://www.dropbox.com/s/ccycdb2zy7yhn8l/VTS_01_8.VOB?dl=0
    Note: the scenes are framed with different cameras having different crops, but I consider only the most used that also is the less cropped.
    (i.e. from 29s to 36s)

    My target for viewing? uhm.. I think is 16:9 but I have to keep mod4 for horizontal and mod2 for vertical.
    Last edited by maudit; 26th Dec 2021 at 04:46.
    Quote Quote  
  13. Originally Posted by dellsam34 View Post
    Okay... But the frame looks like it is squeezed horizontally a little bit judging by the human heads......cut
    I think it looks like squeezed cause of the 720x576 res is displayed with a 4:3 AR, so it becomes 768x576 in order to show the frames not squeezed.
    Quote Quote  
  14. Originally Posted by jagabo View Post
    * It's actually closer to 702x576 but most programs use 704 because it's a nicer number.
    ... and it's mod16
    Quote Quote  
  15. You could also mantain the full 720x576, with SAR 1:1 and change the DAR to 4:3, 16:9 or what you prefer.
    Quote Quote  
  16. Originally Posted by Sharc View Post
    Originally Posted by jagabo View Post
    * It's actually closer to 702x576 but most programs use 704 because it's a nicer number.
    ... and it's mod16
    That's what I meant. It's even mod 64.
    Quote Quote  
  17. Capturing Memories dellsam34's Avatar
    Join Date
    Jan 2016
    Location
    Member Since 2005, Re-joined in 2016
    Search PM
    Here is the sample you posted, I de-interlaced it, cropped it, resized it to 1920x1080 and encoded it, I removed the audio since I cannot process AC-3 and did a sloppy encoding job just to get the file size down, Though with only 426 lines there isn't anything left to work with, The idiot who encoded the DVD screwed it by letter boxing it but sometimes you can't blame those production facilities on the cheap, doing a pan and scan from 16:9 to 4:3 requires the work scene by scene to get a perfect crop from the widescreen shot, It's time consuming, therefore not cheap.
    Image Attached Files
    Quote Quote  
  18. maudit,
    Have you used MeGUI's anamorphic encoding? There's a few different choices. Most don't resize, so the SAR won't change (aside from the aspect error option I described below). One or two will adjust the cropping to ensure a certain mod.
    One anamorphic option can resize, so you can crop just what you need to, resize to the nearest Mod4 or Mod16 dimensions if required, and MeGUI will adjust the SAR to compensate.

    When anamorphic encoding is enabled, MeGUI adds the DAR to the top of the script (you can see it using the AVS Script Creator). Naturally the DAR will change if you crop. MeGUI then calculates the new SAR (if necessary) based on the DAR in the script and the cropped resolution. It'll add the SAR to the command line for you, as long as "Force SAR" is set to "default" in the encoder configuration. Once you save the script, you can open it again in the preview. The DAR is shown at the bottom, and checking "preview DAR" will resize the preview to square pixel dimensions. Changing the DAR at the bottom of the preview over-rides the DAR in the script, so that's something to be aware of.

    MeGUI still uses the old ITU DARs, or an exact 4:3 or 16:9 DAR. I'd recommend creating two custom DARs to use instead of the ITU DARs. 15:11 and 20:11, and I'd also recommend always using 15:11 for 4:3 DVDs. 16:9 DVDs are generally 16:9, unless they're old, in which case they might be 20:11. That applies to both PAL and NTSC.

    By default, MeGUI can fudge the DAR a little. It allows for an exact 4:3 or 16:9 output DAR when the cropping is very close to 4:3 or 16:9. You can disable the DAR fudging in the AVS Profile configuration.

    If you don't resize (only crop), setting 4:3 for the Input DAR for a PAL DVD will result in a 16:11 SAR. Setting 15:11 for the Input DAR will give you the 12:11 SAR jagabo mentioned earlier.

    Image
    [Attachment 62665 - Click to enlarge]


    Image
    [Attachment 62666 - Click to enlarge]


    Image
    [Attachment 62667 - Click to enlarge]
    Last edited by hello_hello; 31st Dec 2021 at 18:39.
    Quote Quote  
  19. hi hello_hello, thanks for answering.
    I've read your message and even if I didn't fully understand it, I tried many times, with several different options combinations,
    but I always get a SAR which differs a lot from the almost correct 16:15 ratio, such as 128:71, 1412:781 or 5648:3195 that produce an oblong video.

    I can't figure out where my error is.
    here's some ss: https://www.dropbox.com/sh/r5wmu47jnueeaa6/AADrY-_066hRQv_I1XXD-E62a?dl=0
    Last edited by maudit; 2nd Jan 2022 at 00:09.
    Quote Quote  
  20. Originally Posted by maudit View Post
    hi hello_hello, thanks for answering.
    I've read your message and even if I didn't fully understand it, I tried many times, with several different options combinations,
    but I always get a SAR which differs a lot from the almost correct 16:15 ratio, such as 128:71, 1412:781 or 5648:3195 that produce an oblong video.
    Those numbers are correct, but they're the display aspect ratio, not the sample aspect ratio. And MeGUI doesn't display the video with the correct DAR in the preview when using anamorphic encoding. It just uses the video dimensions, so don't worry about that. The preview with the correct DAR comes later....

    Without any cropping, for anamorphic encoding MeGUI should add 4:3 or 15:11 to the top of the script, depending on which you choose as the Input DAR, then as you crop the numbers change because cropping changes the display aspect ratio. It doesn't change the sample aspect ratio (resizing changes that).

    The display aspect ratio is the aspect ratio of the picture, the sample aspect ratio is the shape of the individual pixels. If you know the display aspect ratio you can calculate the sample aspect ratio using the video dimensions, or you can calculate the display aspect ratio from the sample aspect ratio (sorry if I'm stating the obvious).

    Height x DAR / Width = SAR
    Width x SAR / Height = DAR

    For the display width it's
    Height x DAR
    or
    Width x SAR

    It might be easier to show you using the CropResize function in my signature as it can use MeGUI's DAR from the script for it's input DAR, then show you the fun stuff.

    For this screenshot I've applied your cropping to a 720x576 video with the Script Creator's Input DAR set to 4:3.

    Top left you can see the video dimensions after MeGUI's cropping are 704x426.

    On the right under Input Aspect you'll see the DAR is the same as the one at the top of the script. The function uses the formula above to calculate the SAR, and as you can see on the next line down it's 16:15 (based on MeGUI's new DAR and the cropped 704x426 dimensions).

    And 704 x 16/15 = 750.93 which is the width shown for the display dimensions.

    Image
    [Attachment 62699 - Click to enlarge]


    Of course all the above will be a little bit wrong as 4:3 DVDs (almost) always have a 15:11 DAR, so the same thing again after selecting 15:11 as the Input DAR in the script creator (the difference isn't huge, 15:11 is about 2.5% wider and it'll give you the 12:11 SAR mentioned earlier).

    Image
    [Attachment 62700 - Click to enlarge]


    If you enable the anamorphic option that resizes, and resize in any way, it will usually change the SAR (which is not shown in the script), as only cropping will change the DAR at the top of the script.

    So.... MeGUI normally does what my function did. It uses the dimensions after cropping/resizing and the new DAR to calculate the SAR for you (all based on the Input DAR you selected in the script creator as the starting point).

    After you save the script and load it into the video section, the preview will show you the same DAR at the bottom.

    Image
    [Attachment 62701 - Click to enlarge]


    Checking "Preview DAR" will cause it to resize the preview to the aspect ratio you'll get on playback (if you change the DAR at the bottom of the preview MeGUI will use it instead, so you'll have to re-load the script to get the original DAR again).

    Image
    [Attachment 62702 - Click to enlarge]


    And finally, if "Force SAR" is set to "default" in the encoder configuration, you'll be able to see the SAR MeGUI calculated in the log file after you start encoding. I saved the script using the 15:11 Input DAR, so it's a 12:11 SAR in the log file. For a 4:3 Input DAR you should see 16:15, but do yourself a favour and go with a 15:11 Input DAR.

    Job command line: "C:\Program Files\MeGUI\tools\x264\x264.exe" --sar 12:11 --frames 38530 --output "D:\Test_new.mkv" "D:\Test_new.avs"

    If you do all that and the SAR in the log file is correct and the encoded video still doesn't display correctly, then maybe it's not 4:3 after-all.
    Or if you get display dimensions of 750x426 rather than 750.93 etc for the encoded video, whatever you're using to get the DAR will be doing the rounding, maybe to the nearest mod2 pixel, but it shouldn't be anything MeGUI is doing.

    That's enough typing for now, so I'll leave the explanation for another day, but if you rip a DVD with MakeMKV, it's far better to open the MKV with TSMuxer, remux the video as a TS file and use that as the video input for MeGUI instead, because then MeGUI will index with DGIndex instead of FFMS2, which can be problematic for DVDs. : )
    Last edited by hello_hello; 2nd Jan 2022 at 15:46.
    Quote Quote  
  21. Capturing Memories dellsam34's Avatar
    Join Date
    Jan 2016
    Location
    Member Since 2005, Re-joined in 2016
    Search PM
    Maudit, You were using the right tool AvsPmod, All what you have to do is crop to the active area and resize to 1440x1080 square pixel easy one step like I did earlier with your sample in post #17, Your video is clearly a 16:9 content letter boxed into 4:3. When you have a low count of lines it is recommended to resize to a higher resolution to avoid line flicker artifact.
    Quote Quote  
  22. I didn't consider any deinterlacing as I came into the thread late and haven't seen the source video, so I just assumed it was either progressive or being de-interlaced in the script first. If it's not being de-interlaced the cropped height should be mod4.

    <shameless plug>

    I generally use MeGUI or AVSPmod to determine the cropping, then once I've worked out the cropping required I disable it and get CropResize to do the work. For an anamorphic output, CropResize will always create MeGUI's global DAR variables so MeGUI will still calculate the SAR for encoding, even if it's anamorphic encoding isn't enabled.

    Even if you don't go that far though, NoResize=true gives you the same anamorphic output, but temporarily removing it and refreshing the preview resizes to square pixel dimensions, so you can see what an anamorphic output will look like on playback. I never use Mod=2 myself, but as maudit was cropping to a mod2 height, I did.

    Image
    [Attachment 62706 - Click to enlarge]


    Resized

    Image
    [Attachment 62707 - Click to enlarge]


    </shameless plug>
    Last edited by hello_hello; 2nd Jan 2022 at 17:22.
    Quote Quote  
  23. dellsam34,
    I checked out your sample and something definitely went wrong with the de-interlacing. Navigate to frame #3200 in your sample and step through the frames one at a time and you'll see what I mean. Judging from the pattern I suspect it's some sort of telecine rather than being interlaced, but I'm just taking a wild guess there.
    Quote Quote  
  24. Capturing Memories dellsam34's Avatar
    Join Date
    Jan 2016
    Location
    Member Since 2005, Re-joined in 2016
    Search PM
    My sample was not by any mean for viewing purposes, it is just to show the cropping and resizing in relationship to the new 16:9 aspect ratio, It was a quick and sloppy processing job as I've already mentioned it in the very same post.
    Quote Quote  
  25. Originally Posted by hello_hello View Post
    I checked out your sample and something definitely went wrong with the de-interlacing. Navigate to frame #3200 in your sample and step through the frames one at a time and you'll see what I mean. Judging from the pattern I suspect it's some sort of telecine rather than being interlaced
    No, he just had the wrong field order. Apply SelectEvery(2,1,0) and you'll see the frame progression is fixed.
    Quote Quote  
  26. Originally Posted by jagabo View Post
    No, he just had the wrong field order. Apply SelectEvery(2,1,0) and you'll see the frame progression is fixed.
    Yeah you're right about that, however I still can't get my head around why without SelectEvery(2,1,0) the pattern isn't a consistent forwards, backwards, forwards, backwards....

    Instead it does a forwards, backwards, forwards, backwards, forwards, forwards, forwards, backwards thing, although that's not a consistent pattern either.
    Quote Quote  
  27. Capturing Memories dellsam34's Avatar
    Join Date
    Jan 2016
    Location
    Member Since 2005, Re-joined in 2016
    Search PM
    I did that on whim I didn't even check what was selected TFF or BFF, Having said that I started to have problems with my vdub software, It doesn't seem to make a difference anymore whether I select TFF or BFF both I get jumping forward and backward, I tried several AVI files. I think it's time to remove it and re-install it and hopefully it will clear the corruption.

    Anyway, I hope I did not derail the thread, Back to topic.
    Quote Quote  



Similar Threads