VideoHelp Forum




+ Reply to Thread
Page 2 of 2
FirstFirst 1 2
Results 31 to 37 of 37
  1. If I was to resize a 1080p video while masking it, I'd definitely resize to 1280x? first, then add the borders for 1280x720. It'll take a bit more calculating to get it right, but resizing 1080p video that already has black borders will almost certainly result in the edge of the picture and the edge of the black borders being a little blurred, rather than nice and sharp. If the 1080p video already had black borders I'd crop them, resize to 1280x?, then add them back for 720p.

    I've read complaints about borders not encoding completely "clean" too. ie a few rows of pixels at the edge of the video and/or a few rows of black pixels blur a little. I don't know if the mod makes any difference to that as I almost never encode with black borders myself. I know from previous tests the borders make little difference to compression efficiency.... well it barely changes the bitrate when using CRF encoding, so assuming CRF does always produce a constant quality with identical settings.....
    Encoding a couple of hours of black on it's own only results in a video of a few MBs in size.

    As this thread seems to be to discussing theoretical storms in teacups, I thought I'd try a few test encodes.
    I took a 1920x804 video and cropped it to a height of 128 pixels like this:
    crop(0, 672, 0, -4)
    I added mod16 borders to begin with, then moved the picture up a little for each encode while making note of the resulting bitrates after encoding 10,000 frames with x264's default settings and CRF18.

    AddBorders(0,64,0,64) (mod16 borders)
    825 kbps
    Click image for larger version

Name:	64 64.png
Views:	133
Size:	478.4 KB
ID:	39425

    AddBorders(0,62,0,66) (mod2 borders)
    860 kbps
    Click image for larger version

Name:	62 66.png
Views:	142
Size:	482.4 KB
ID:	39426

    AddBorders(0,60,0,68) (mod4 borders)
    835 kbps
    Click image for larger version

Name:	60 68.png
Views:	114
Size:	486.8 KB
ID:	39429

    AddBorders(0,56,0,72) (mod8 borders)
    801 kbps
    Click image for larger version

Name:	56 72.png
Views:	125
Size:	482.1 KB
ID:	39428

    No Borders
    774 kbps
    Click image for larger version

Name:	No Borders.png
Views:	127
Size:	464.4 KB
ID:	39430

    Source (Avisynth output before encoding, no borders)
    Click image for larger version

Name:	Source.png
Views:	127
Size:	480.9 KB
ID:	39432

    It's interesting that compared to mod16 borders, the mod8 borders actually caused the bitrate to drop. I suspect it's related how much motion the encoder sees, but that's just a guess because I don't understand it. I think that was originally one of the reasons cropping was recommended in the early days, because the borders messed with motion estimation or something along those lines, but it doesn't seem to make much difference for x264.

    The bitrate differences in these tests are probably greater than they'd be under normal circumstances, where the ratio of picture to black would be far higher.

    My personal confabulation: Mod2 borders might require a slightly higher bitrate than mod4 borders, but none of it really matters.
    Can anyone explain the mod8 bitrate drop?

    Edit: While I was at it, I thought I'd try another round of encodes, but this time I cropped 2 pixels less from the source to make the output 130 pixels high (mod2), before adding the same borders.

    Crop(0, 670, 0, -4).AddBorders(0,64,0,64) - 885 kbps (mod16 borders)
    Crop(0, 670, 0, -4).AddBorders(0,62,0,66) - 834 kbps (mod2 borders)
    Crop(0, 670, 0, -4).AddBorders(0,60,0,68) - 866 kbps (mod4 borders)
    Crop(0, 670, 0, -4).AddBorders(0,56,0,72) - 801 kbps (mod8 borders)
    Crop(0, 670, 0, -4) # No borders - 914 kbps

    Interesting.... adding borders always reduced the bitrate a little when the video was mod2, compared to increasing it when the video was mod16.
    I'd still like to understand the bitrate drop due to mod8 borders, but it still seems none of it really matters
    Last edited by hello_hello; 11th Nov 2016 at 19:47.
    Quote Quote  
  2. Originally Posted by _Al_ View Post
    Mask it two times. Once for 1920x1080 and export, second time for 1280x720.

    Two scripts, so second one for example is resize to 1280x720, where masking follows to desired heights (black bars and image), not the other way. Do not mask in NLE.

    Similar problem occurs while autocropping in Avisynth script and resizing for example. Where it is better to resize first from 1920x1080 to 1280x720 and only then to autocrop using desired mod. Otherwise some insane calculations and dirty business is happening.
    The thing is Avisynth is not part of my workflow for 1080p delivery, and I am not about to insert it for such mundane tasks like masking. I only call on Avisynth when one of its filters has an edge over an NLE like when I need to deliver 720p because the bundled resizers in commercial NLEs are usually not very good. My thinking was import the letterboxed 1080p export into Avisynth, crop the letterbox (since I know its exact dimensions), then downrez before adding borders to bring back to full 720p. That, I think, would produce acceptable results unless the resizing filters choke on some non-standard resolution.

    At some point I will get a chance to test all this and come up with a vetted workflow.
    Quote Quote  
  3. Originally Posted by SameSelf View Post
    The thing is Avisynth is not part of my workflow for 1080p delivery, and I am not about to insert it for such mundane tasks like masking. I only call on Avisynth when one of its filters has an edge over an NLE like when I need to deliver 720p because the bundled resizers in commercial NLEs are usually not very good.
    Who'd have guessed resizing isn't a mundane task.
    Quote Quote  
  4. Why to avoid it, one lossless avi (if frame serving is not possible or avoided), no masking yet, rest in avisynth, masking is just really easy using crop and then addborders, this is for 2.35 AR > needs height 544 for 1280:
    Code:
    Avisource("1920x1080.video.avi")
    Spline36Resize(1280,720)
    Crop(0,88,0,-88)
    AddBorders(0,88,0,88)
    if you want to place image higher 16 points for example
    Code:
    Crop(0,72,0,-104)
    AddBorders(0,72,0,104)
    or use avisynth preview (virtualdub, mpc-hc, etc) if you need to see your video to decide where to "reveal" your image , the same like in NLE

    If you mask it in NLE, not using Avisynth, numbers start to flow differently after resizing, so you need to calculated it twice and for 1280x720 image you need to mask differently to get your desired macroblock 8 and keep ar 2.35 in both casesetc., but I think it does not matter really.
    Last edited by _Al_; 11th Nov 2016 at 19:17.
    Quote Quote  
  5. I looked at a few theatrical films that are online and compared them side-by-side with my own mask since I have a dual monitor setup. What I quickly found is that the height seems to be all over the map. There is clearly not one agreed upon AR when encoding.
    Quote Quote  
  6. Anybody can crop it a bit differently and also all movies are not the same. But there is a pattern. Example of bunch of 25 movies or so I did myself from BD , resized to 720p and auto-cropped, mode 4:
    1280x532-12 times
    1280x536 -6 times
    1280x640 - 1 time
    1280x692 - 3times
    1280x720 - 2 times
    so movies does not always have the same aspect ratio, any of that height result matches some aspect ratio, but I would not bother, it really does not matter
    Last edited by _Al_; 12th Nov 2016 at 17:34.
    Quote Quote  
  7. Thanks for posting. That is a very interesting result and probably more accurate than my survey. Since 1280x532 is the most common choice, this implies that 2.40:1 is the most common AR which makes sense since 532 is mod4 while 534 is only mod2. Masking to 1280x532 is also equivalent to masking to 1920x798, but 798 is only mod2. Therefore, it looks like one needs to mask twice if delivering both 1920 and 1280.
    Quote Quote  



Similar Threads

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