Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
|
|
Thread Tools | Search this Thread | Display Modes |
7th July 2013, 14:21 | #1 | Link |
Registered User
Join Date: Dec 2002
Posts: 18
|
Tool or plugin to detect effective visual resolution of a video?
Hi
I've been wondering about this for awhile with regards to ripping Blu-Ray content to something smaller and more portable. Often, especially with older color film shot up to about the late nineties, ripping them to 1080p is pointless, as the source is way too soft to give you that amount of actual detail (save for noise, which sometimes is nice enough to keep). Sometimes it seems that even 720p would be wasted on them (like with really cheap 8mm productions, or just low-grade equipment and lenses). It'd seem reasonable to resize these videos to whatever their actual effective optical resolution is before encoding them to whatever target I'm going for. What that resolution exactly is, however, can be pretty tricky to determine. Even if you sample yourself to something that seems reasonable in one scene, it might not be representative of the entire film. Some scenes might be shot under better conditions, at a different aperture, using better equipment, etc. So I'm wondering if there exists some kind of tool or plugin that's able to scan a video source for visual resolution, sort of like a media player might scan your tracks for volume levels. I find it pretty difficult to search for on Google — so now I'm asking here, where so many experts hang out Hope to hear something positive from you Thanks in advance, Daniel Last edited by DanielSB; 7th July 2013 at 14:23. Reason: Spelling |
7th July 2013, 15:54 | #2 | Link |
Retried Guesser
Join Date: Jun 2012
Posts: 1,373
|
It's an interesting question, but - there is little benefit to resizing before compression. Softer sources will automatically compress better, whatever their resolution (DCT transform & quantization takes care of that - if there is no information at a given spatial frequency, no bits are needed to encode it). Not taking noise into account, as you mention.
Last edited by raffriff42; 7th July 2013 at 16:12. |
8th July 2013, 10:03 | #3 | Link |
Registered User
Join Date: Dec 2002
Posts: 18
|
Interesting. I've noticed how really undersized rips will tend to just "reduce resolution" until they look pretty much like your average DVD rip or worse (e.g. a YIFI "1080p" rip). I'm guessing it's the same mechanism kicking in there?
But, besides the noise aspect (which I assume would mean I'd have to use some kind of (temporal) noise filter, which I'd rather not), I find it difficult to believe that it can really be as effective at reducing the bitrate to "accommodate" the bit usage on the basis of effective resolution? Also, how well does that mechanism deal with high vs. low motion scenes? Looking at other's encodes that are shared in both 720p and 1080p where the source material is really soft, the size difference can oftentimes be 100% while offering close to zero visual difference (provided that your player uses a good scaling algorithm such as Lanczos or Spline — if not, you'll notice the curves being slight less smooth (and sharp) on the 720p version). On some occasions, indeed, I find that the 720p version is actually the better looking one. Thanks, Daniel |
8th July 2013, 11:42 | #4 | Link |
Retried Guesser
Join Date: Jun 2012
Posts: 1,373
|
OK I made a sweeping generalization there - sorry about that. For instance, at very low bitrates - 0.5 MB/s - resizing can help tremendously. A full size, high motion, low bitrate video might be an unwatchable mass of macroblocks, where the same video downsized might look blurry, but good otherwise.
|
9th July 2013, 02:28 | #6 | Link |
Retried Guesser
Join Date: Jun 2012
Posts: 1,373
|
@DanielSB, here's something - it isn't a tool yet, it's more of a toy - but this script compares a resized video to the original.
* If you can make out the picture in the difference image, you are losing valuable information. * OTOH if the difference looks random, you aren't losing anything significant. I don't know if this can be boiled down to a simple "go / no go" test...anyone? Code:
#avisynth ## open source: A=DirectShowSource("path to video") A=A.ConvertToYV12(matrix="PC.709") ## Full range ## test resize: B=A.Spline36Resize(640, 360) ## restore to original size (for comparison w/ original) B=B.Spline36Resize(A.Width, A.Height) ## optional crop for 1280x720 final output: A=A.Crop(0, 0, 512, 360) B=B.Crop(0, 0, 512, 360) C=mt_lutxy(A, B, "x y - abs").Greyscale() ## /v2 A=A.Levels(0, 1.0, 255, 16, 235) B=B.Levels(0, 1.0, 255, 16, 235) return StackHorizontal( \ StackVertical( \ A.Subtitle("orig"), \ B.Subtitle("resized")), \ StackVertical( \ C.Tweak(bright=15).Histogram().Subtitle("diff"), \ C.mt_lut("x 4 *").Tweak(bright=12).Histogram().Subtitle("diff x 4"))) Last edited by raffriff42; 18th March 2017 at 01:38. Reason: (fixed image link) |
9th July 2013, 07:21 | #7 | Link |
Registered User
Join Date: Dec 2002
Posts: 18
|
That's some darn nice lateral avisynth fu there, raffriff42!!!
I wonder if that could be automated in any way? Like, the amount of white would appear to be the level of details lost. So, if one could like set a threshold and have the script exit with an error if it goes above that threshold? I'm not quite sure on how to actually understand the output, though... What's the first "diff" image, for instance? |
9th July 2013, 10:51 | #8 | Link | ||
Retried Guesser
Join Date: Jun 2012
Posts: 1,373
|
Thanks!
Quote:
Quote:
This is a trick I use all the time when working with images, and I wanted an Avisynth script to do the same thing. It uses MaskTools' mt_lut because that's what I was reading about at the time The second diff image exaggerates the first by 4x to make the changes more visible. * Overlay(mode="subtract").Tweak(bright=16) is actually closer to Photoshop; the mt_lut method I show might be "better" because of the "absolute value" term. It shows all differences, where the Overlay/Photoshop method "hides" the negative-going diffs. Last edited by raffriff42; 9th July 2013 at 12:21. |
||
10th July 2013, 11:35 | #9 | Link |
Registered User
Join Date: Dec 2002
Posts: 18
|
Aahh! So the first diff is the diff from resizing, and the second one is the same diff, but exaggerated?
I sort of "read it" from left to right and saw #2 diff as the actual diff created, so I was wondering how there could be a diff on the original image, I wanted it to be all black That's not a whole lot of difference, though, considering the visual difference between the two. It'll be fun to actually try this on a source from a soft BluRay at 1080p vs. 720p! Thanks again, man, it's really cool! |
14th July 2013, 10:49 | #10 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,990
|
@raffriff42
I dont really use masktools much but would not 2nd line below have less potential precision loss at the subtract stage. Code:
## rejigger Subtract() to show diff as absolute value: #C=Subtract(A, B).Greyscale().mt_lut("128 x - abs") C=mt_lutxy(A,B,"x y - abs").Greyscale()
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? |
14th July 2013, 12:14 | #11 | Link |
Retried Guesser
Join Date: Jun 2012
Posts: 1,373
|
Absolutely, it would! Thank you. I'm barely acquainted with MaskTools myself, but yes, it'd be better to do all arithmetic in floats. Compared to yours, my version has many ±1 errors and a few pixels off by ±3. Comparison was made after correcting my LUT to "127 x - abs" [oops.gif]
I'll update the script with your change. Thanks again. |
Tags |
actual resolution, effective resolution, perceived resolution, resolution, scan |
Thread Tools | Search this Thread |
Display Modes | |
|
|