VideoHelp Forum




+ Reply to Thread
Page 3 of 3
FirstFirst 1 2 3
Results 61 to 81 of 81
  1. Sorry, double post.
    Quote Quote  
  2. Progressive YV12 video has chroma planes that are half the size of the luma plane. So a 720x480 YV12 video has a 720x480 luma plane (Y, greyscale) and 360x240 chroma planes (U and V, colors added or subtracted from the greyscale image). If you wanted to crop one pixel off the width, making it 719 pixels wide, you'd have 359.5 pixels in the chroma planes. But you can't have half pixels. So you must crop an even number of pixels. 718x480 would be fine with a 718x480 luma plane and 359x240 chroma planes.
    Quote Quote  
  3. Ah, that makes sense, thanks.

    Ok, so I attempted to use the resize script because I realized that if I cut off borders, I'd get a different size than the original 720x480. So I added that size into the settings:

    Click image for larger version

Name:	avis4.png
Views:	699
Size:	735.1 KB
ID:	36632

    And the result seems wider (?) than the original unless I'm seeing things? Am I resizing it wrong after the cropping, how do I make it exact (should I be resizing)?

    The file is attached. Btw I used this guy's method of turning the script into MP4 using his preset and WinFF. Would you say this way is okay or not as good as your x264 route?
    Image Attached Files
    Quote Quote  
  4. You didn't account for the sample aspect ratio or display aspect ratio when you encoded. That's why your picture is too wide. You should set the SAR (x264 setting) to 10:11 or the DAR (container setting) to 4:3.
    Quote Quote  
  5. You didn't account for the sample aspect ratio or display aspect ratio when you encoded. That's why your picture is too wide. You should set the SAR to 10:11 or the DAR to 4:3.
    I don't see that option in avisynth, so inside of WinFF?

    Click image for larger version

Name:	winff.png
Views:	1193
Size:	35.9 KB
ID:	36637

    Anywhere to do it in here? I don't see any part stating SAR or DAR.
    Quote Quote  
  6. As I said, it's an encoder or muxer settings. I'm not familiar with WinFF. You'll have to look for a guide that tells you the format to use.
    Quote Quote  
  7. Originally Posted by CZbwoi View Post
    crop(10,0,-10,-4)
    you are changing vertical resolution and resizing, so why not resizing to square pixel right away instead , anything that gives 4:3, like 640x480 or 720x540, so no SAR settings in encoder or muxer needed

    or

    you might try crop(8,0,-8,0) and no resize getting 704x480, setting SAR 10:11,..., that 704x480 is also DVD friendly resolution,.., having 4 pixels of black , that is fine in a picture, if it is not just nice black (VHS capture) , crop those 4 pixels and then pad black 4 pixels in Avisynth right back
    Quote Quote  
  8. Yes, after that crop 720x480 is the wrong resize. It should really be 706x480. Or, on a variation of _Al_'s suggestion, resize to 704x480 and set the 10:11 SAR in the encoder. Or resize to 640x480 directly after the crop and use a 1:1 SAR.
    Quote Quote  
  9. you are changing vertical resolution and resizing, so why not resizing to square pixel right away instead , anything that gives 4:3, like 640x480 or 720x540, so no SAR settings in encoder or muxer needed
    Before any cropping is down or afterwards? And is there a definite size for Hi8/8mm tapes, like should they all be in 4:3 or should it really be 706x480 like manono said which...isn't 4:3? What's the actual ratio that tapes are supposed to be in...Hi8, 8mm, Super8, VHS, VHS-C? Because I'm noticing that all these captures are always slightly wider than what looks normal.

    you might try crop(8,0,-8,0) and no resize getting 704x480, setting SAR 10:11
    Yes, after that crop 720x480 is the wrong resize. It should really be 706x480. Or, on a variation of _Al_'s suggestion, resize to 704x480 and set the 10:11 SAR in the encoder. Or resize to 640x480 directly after the crop and use a 1:1 SAR.
    I keep on hearing about SAR's and have no idea where to do that, the only encoder that I have or know how to work is WinFF and I see no settings in there for that.

    Can you tell me what you guys use to encode Avisynth files with x264 and muxing? Jagabo uses a 'batch file' method with x264.2692.x86.exe and a line of code that I don't understand since they never explained it.

    Also would you recommend encoding to x264 if you're dealing with lossless huffyuv capture files and you want to downsize for shareable sizes? Is there another similar codec to go to or is x264 the standard?
    Quote Quote  
  10. Code:
    DAR = FAR * SAR
    DAR = display aspect ratio, the final shape of the displayed picture
    FAR = frame aspect ratio, the frame dimensions
    SAR = sampling aspect ratio distance between pixels horizontally and vertically

    Think of SAR as the shape of individual pixels (it's sometimes called PAR, pixel aspect ratio).

    Most capture devices follow the ITU spec where the 4:3 image is captured in a 704x480 frame with (optionally) 8 extra pixels at the left and right edges in case the picture is a little off center. The SAR for that is 10:11. So if you crop a total of 16 pixels off the left and right edges you're left with a 704x480 frame and:

    Code:
    DAR = FAR * SAR
    DAR = 704:480 * 10:11
    DAR = 704/480 * 10/11
    DAR = 704 * 10 / 480 / 11
    DAR = 1.333...
    DAR = 4:3
    To get the right display aspect ratio you can specify the SAR when you encode or you can resize to a frame size that matches the DAR and encode as square pixel (SAR = 1:1):

    Code:
    DAR = FAR * SAR
    DAR = FAR * 1:1
    DAR = FAR * 1 / 1
    DAR = FAR
    So you could resize from 704x480 to 640x480 to get the correct display aspect ratio. Often the extra pixels at the left and right aren't cropped away and the entire 720x480 frame is resized to a 4:3 frame size. That's technically wrong by about 2 percent but you can't really see such small differences in aspect ratio.

    When you encode your video you have two choices: you can resize to square pixels (the player will assume DAR = FAR), or you avoid resizing and flag the SAR (the player should do the appropriate math to get the proper DAR).

    Some players (for example those found in some TVs that can play MP4 files on USB flash drives) ignore the SAR flags and display all videos as if DAR = SAR. So it's safest to resize to square pixels. But resizing can lose quality and create artifacts.

    In your earlier script you cropped down to 700x476. You could just specify the SAR as 10:11 and let the player handle the resizing. Or you can calculate the correct square pixel frame size and resize yourself:

    DAR = FAR * SAR
    DAR = 700:476 * 10:11
    DAR = 700/476 * 10/11
    DAR = 700 * 10 / 476 / 11
    DAR = 1.3369

    Since your frame height is 476 the proper width is 476 * 1.3369, about 636 pixels. So resizing to the 700x476 frame to 636x476 would give the correct aspect ratio.
    Quote Quote  
  11. To oversimplify it (not counting your screen resolution or resolution of your player window) --> SAR is a number, flag, that if player finds it in video, it multiplies horizontal resolution by it.

    So in your case horizontal resolution is 704, so 704 * 10/11= 640

    So you see, those 640x480 (4:3) , square pixel, you get on screen with that SAR flag, correct proportions on screen, circle is really a circle, not ellipse. So even if video footage is not square pixel, which VHS, DV avi, HDV is (it could be called anamorphic video) it is shown on screen proportionally correct even if it is not stored like that.

    To understand it even better. Most familiar to you is DVD, it is always stored in 720x480 (NTSC) and only that "flag" in it on DVD decides what you are going to actually see. 4:3 video or 16:9 video. Everything is stored in 720x480 (or 704x480).

    Resize is done after crop. If resize is done at all.
    Quote Quote  
  12. You can resize before cropping. In fact it can make the AR calculations much simpler. Say you have a 704x480 4:3 DAR video and you want to crop visually (to remove black borders or whatever). You already know that the full frame resized to 640x480 gives the right aspect ratio. So if you resize first and crop the black borders you don't need to make any AR calculations. No matter how much you crop, the remaining picture has the right aspect ratio.
    Quote Quote  
  13. Originally Posted by jagabo View Post
    You can resize before cropping. In fact it can make the AR calculations much simpler.
    Yes, op works with a special case where aspect ratio is known. That cropping has to follow some rules as well, you discussed it already, I was afraid op would crop to a weird size.

    Trying to write a script that crops and resizes, it forces one to actually do that in that order - resize and then crop. Talking about Blu-Ray, but principle is the same. 1920x1080 is resized to 1280x720 and then Autocrop.dll generates crop line getting 1280x536 or something depending on wMultOf, hMultOf.
    Quote Quote  
  14. Ok, phew that was a lot to take in and I"m trying to make sense of it all, thanks guys.

    Here is what I did last night before going to bed:

    Code:
    avisource("test elgato 4.avi")
    Spline36Resize(640,480)
    AssumeTFF()
    ColorYUV(cont_u=47, cont_v=118)
    ConvertToYV12(interlaced=true)
    QTGMC()
    Sharpen(0.21, 0.0)
    Crop(6,4,-6,-6)
    So, I resized it first to 640x480. Then at the end is when I implemented some cropping, 6 off the left, right and bottom, and 4 off the top. Does it matter if a part of it is not equal, does it affect playback on anything? 4 off the top is all I needed, but in turn I needed 6 off the bottom...does this mess with anything since it's not equal?

    Okay, so now my exported file (through WinFF, where I changed no aspect settings or anything) is 628x470 (attached file). Is this a bad ratio to stay at since it's uneven due to the 4 at the top vs. the 6 at the bottom like I said? Would it screw up playback on a device, TV, DVD/Blu-ray player?

    Or when I'm done with the cropping in that code I posted, should I cap it off with another resize to 640x480 in AvsP? Would that make things worse since I'd be "stretching the pixels or picture" once again but this time from a smaller state of 628x470?


    Side-question: This hasn't been answered yet so I just want to make sure. The definitive, absolute correct and only aspect ratio that Hi8, 8mm, VHS-C and VHS tapes should be in is 4:3 aka 640x480, right? Meaning every tape I capture, which will be received in 720x480, should be ultimately converted to 640x480 (or an equal variation of it, 4:3, accounting for cropped pixels).
    Image Attached Files
    Quote Quote  
  15. You don't have to crop evenly on both/all sides. But I recommend you avoid mod2 frame sizes, and stick with mod4 or larger. Most codecs and devices can handle mod2 these days but a lot of older device don't. You don't want to find that the TV or media player you buy next year chokes on half your video files because you encoded mod2. So what if there's a pixel or two of black border at the edge of the frame. Or you'll never notice a missing few rows or colums if you crop a bit more.

    Another issue is what you plan to do with the videos. If you plan to make DVDs for example you are restricted to certain frame sizes. 720x480, 704x480, 352x480 and 352x240 for NTSC video.

    I've never seen a VHS tape that was any aspect ratio other than 4:3. Though it's certainly possible that some might have been 16:9 -- especially in PAL regions which had widescreen TVs long before the US.
    Quote Quote  
  16. But I recommend you avoid mod2 frame sizes, and stick with mod4 or larger. Most codecs and devices can handle mod2 these days but a lot of older device don't. You don't want to find that the TV or media player you buy next year chokes on half your video files because you encoded mod2.
    Can you explain what mod2 and mod4 exactly is and what the differences are? I'm googling it and getting handgun sizes. The closest thing I got was this, but it doesn't mention mod2 or mod4 anywhere.


    Also I just learned how to encode it out into x264 inside of AvsPmod, and I see these options:

    Click image for larger version

Name:	say.png
Views:	2679
Size:	54.3 KB
ID:	36679

    I think this is what you were talking about. Say that I crop it out to a weird size again, 706x480, all I would have to do for it to turn into the correct aspect ratio and turn it into 640x480 is select NTSC 4:3 - 10:11? No matter what it will change it's aspect ratio to 640x480 and nothing else? And what's the difference between that one and NTSC VCD - 10:11, should I ever use the latter?

    I've never seen a VHS tape that was any aspect ratio other than 4:3.
    I was more so asking about 8mm/Hi8/Super 8/VHS-C tapes, I knew VHS tapes were probably all in 4:3 in the States as it took us a long time to get away from 4:3 TVs, but for those old camcorders I don't really know.
    Quote Quote  
  17. Member
    Join Date
    May 2014
    Location
    Memphis TN, US
    Search PM
    Originally Posted by CZbwoi View Post
    Can you explain what mod2 and mod4 exactly is and what the differences are? I'm googling it and getting handgun sizes. The closest thing I got was this, but it doesn't mention mod2 or mod4 anywhere.
    Mod stands for modulus, another term for absolute value. Basically mod2 is a number that is evenly divisible by 2 with no fractions or decimal places left over. A mod4 number can be evenly divided by 4. Note that mod4 automatically means it's also mod2.

    Example: 8 can be evenly divided by 2.
    8/2 = 4, which is mod4 and a whole number with no remainder. Therefore 8 is mod2 and mod4, and is also mod8 (8/8=1)

    Many encoders and decoders work on a mod8 basis, the reason being that encoding/decoding is often based on 8x8 pixel blocks. You'll encounter some Avisynth filters that won't work on a frame that isn't at least mod8 in all dimensions.

    Many common video formats use mod16 frame sizes: 480, 576, 704, 720, 1280, and 1980 are all mod16 numbers. Two common HD frame sizes that don't use all-mod16 frames are 1920x1080 and 1440x1080. 1080 is not mod16. But it is mod8.

    Some people take a 720x480 video and make it 854x480 to get 16:9. Notice that 854 is not mod16, mod8, or mod4. It's mod2. The safe compromise is 856x480. 856 is mod8.

    I don't use AvsPmod.
    Last edited by LMotlow; 20th Apr 2016 at 08:36.
    - My sister Ann's brother
    Quote Quote  
  18. Originally Posted by CZbwoi View Post
    Can you explain what mod2 and mod4 exactly is and what the differences are?
    For video purpose the mod is the largest power of 2 (2, 4, 8, 16, 32...) by which the number is divisible by giving an integer result. 720 is mod16: 720/16=45, but 720/32=22.5, so not mod32. 718 is mod2: 718/2=359, 718/4=179.5 so not mod4.

    In the past, some codecs have required mod 8, 16, or even 32. But almost all modern media players, software or hardware, will accept mod4. Most will accept mod2 but the difference between mod4 and mod2 is small so just be safe and shoot for mod4.

    Originally Posted by CZbwoi View Post
    Also I just learned how to encode it out into x264 inside of AvsPmod, and I see these options:

    Image
    [Attachment 36679 - Click to enlarge]


    I think this is what you were talking about. Say that I crop it out to a weird size again, 706x480, all I would have to do for it to turn into the correct aspect ratio and turn it into 640x480 is select NTSC 4:3 - 10:11?
    That's the idea. No matter how much you crop, setting the PAR to 10:11 will cause the player to display the remaining picture with the right aspect ratio. But that's not necessarily a 4:3 frame. For example if you cropped down to 352x480 the picture will display with 2:3 frame but the aspect ratio of objects within that frame will be drawn with the proper aspect ratio. Eg, a circle will still be a circle, a square still a square.
    Quote Quote  
  19. Thanks for the explanations, that makes sense.

    I don't use AvsPmod.
    Do you use anything better or do you just open up a blank text file and have at it?

    That's the idea. No matter how much you crop, setting the PAR to 10:11 will cause the player to display the remaining picture with the right aspect ratio. But that's not necessarily a 4:3 frame. For example if you cropped down to 352x480 the picture will display with 2:3 frame but the aspect ratio of objects within that frame will be drawn with the proper aspect ratio. Eg, a circle will still be a circle, a square still a square.
    Okay, so setting the PAR to 10:11 won't re-size videos to 640x480 but instead add frames making it "4:3" even though the final resolution won't be "640x480"?


    And if I crop off from the top and bottom of my 720x480 capture, would adding Spline36Resize(640,480) at the end stretch it out (the top and bottom) and make things slightly worse quality since I removed some of the frame height and I'd be stretching it up? For the width I'd be stretching things together so there'd be nothing lost there or altered.

    Or would a better idea be to keep the file as is, say 628x470, and add the 10:11 in encoding?

    Does the former method "stretch out the top and bottom" and quality during Spline36Resize since my height would already be lower than 480 due to the cropping? Or would the latter be a better idea?
    Quote Quote  
  20. Originally Posted by CZbwoi View Post
    Okay, so setting the PAR to 10:11 won't re-size videos to 640x480 but instead add frames making it "4:3" even though the final resolution won't be "640x480"?
    this:
    Originally Posted by _Al_ View Post
    To oversimplify it (not counting your screen resolution or resolution of your player window) --> SAR is a number, flag, that if player finds it in video, it multiplies horizontal resolution by it.

    So in your case horizontal resolution is 704, so 704 * 10/11= 640

    So you see, those 640x480 (4:3) , square pixel, you get on screen with that SAR flag, correct proportions on screen, circle is really a circle, not ellipse. So even if video footage is not square pixel, which VHS, DV avi, HDV is (it could be called anamorphic video) it is shown on screen proportionally correct even if it is not stored like that.

    To understand it even better. Most familiar to you is DVD, it is always stored in 720x480 (NTSC) and only that "flag" in it on DVD decides what you are going to actually see. 4:3 video or 16:9 video. Everything is stored in 720x480 (or 704x480).

    Resize is done after crop. If resize is done at all.
    Yes, video is not resized and no 4:3 frames are physically made. That 10/11 is just a stored value for player, it is stored in video stream. Resizing is done while viewing that video on screen.
    Quote Quote  
  21. I see...so now going off of the question that I ended my last post with, which way would be better for me to do? If it's 628x470 with 10:11 encoding, that's still bad since the 470 would only be a mod2, right? Would a better choice be to re-size it up to 640x480 inside avisynth or would that "stretch things out" and degrade quality, even if slightly?

    Simply put:

    * 628x470 to 640x480 (which would be re-sizing and stretching up) with 1:1

    or

    * 628x470 with 10:11

    Which is better, more ideal, compatible, no quality lost, etc.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!