Closed Iounno closed 1 month ago
Could you share some links and screenshots of videos where the borders are cut off incorrectly?
Hey Wessel, thanks for the quick response! As I find more examples I'll happily provide more. The video I was watching last night that had the issue is: https://youtu.be/VGPkfYKi7-g?si=LH1qCoJrTNN0roJ4&t=474 starting at 7:54 (linked start) until about 8:03. You can also see it around the 0:53 mark and a lot of parts of this video whenever they use clips. The best examples I run into is the "vignette" effect around 4:3 videos where it cuts the top/bottom and sides. In this example it only cut the top and bottom.
Aha, everyone has a slightly different expectation of the black bar removal feature. Some people want it to crop to small pictures in the middle, some want it to show logo's or webcams in the corners and some don't.
That why I've introduced the "Detection: Ignored elements" setting recently. You might want try a lower value like 10% or 20% to force it to crop less quickly:
Here is a good example of what it does: https://github.com/WesselKroos/youtube-ambilight/issues/225#issuecomment-2002023180
Wow! I was at 30% before and switching to 10% completely fixed the issue at least to the point where it no longer makes the top and bottom a color but instead completely black which is much more friendly on the eyes.
Frankly, if you're really bored I'd still like it to ignore changing anything except greater than 16:9, but I'm sure that's a ton of work and I don't expect it. The solution you gave is a great workaround. Thanks for your help and dedication on the add on!
Instead I'll move the "Detection: Ignored elements" setting to the non-advanced settings panels in the future, to make the option more obvious. (And probably might have to make the name more explanatory as well.)
Understood thank you! As a side note, even with 10% it's being a bit glitchy on this video https://www.youtube.com/watch?v=UsWh21rFzh8 around 2:00 - 2:20 where it has the opening and constantly changing "resolution" video, it's flickering back and forth between cutting off the FIA logo at the bottom and not. Really not a big deal but just a heads up.
Video frames are always a bit noisy. So it can happen that once in a while a bar is right on the edge of being detected.
In case of your example, I suspect that the black bar detection lines sometimes touches one of the logo's and sometimes goes right through them. There are 10 scanlines (5 at the top, 5 at the bottom), of which the position is randomized each frame and taken an average from over multiple frames for more precision. With an "Ignored elements" setting of 10%, all the scanlines should be equal to qualify as a black bar. With 20% only 95% of the scanlines should be equal. So you might want to change to 20% to ignore logos like these.
10% detects a black bar with these scanlines:
But not when a scanline touches the logo:
And 2:16 is also challenging edge case. There is a black bar, with very dark grey sidebars. Those are not part of the black bars in the video:
But that variation of brightness/colors is inside the black bars of this other video. Because the colors of the video leak into the black bars. So when we decrease the allowed brightness/color variation, it would mean that the black bar detection does not work in this video:
https://www.youtube.com/watch?v=YoLJ4CWSLSI
Conclusion: It's complicated to find a good average for these thresholds. But feel free to let me know ideas on how to improve the detection precision further. I'm always happy to experiment with ideas that can improve the detection for most videos.
I've decided to add an overlay that contains some stats and a visualization of the detection algorithm in real-time:
To make debugging the bar detection easier and because questions/reports about the bar detection started to increase in the past few months.
In the next version the overlay can be enabled via the "Bar detection" setting in the "Stats" group:
And hover over it with the mouse to read the legend:
Here is a good example of why an ignore percentage of 20% or 30% is more accurate with logos and for boxes frames than the 10% option.
10%:
20%:
I might have found a way to detect through logos
Is your feature request related to a problem? Please describe. I have a 21:9 monitor and videos are typically 16:9. I would like to disable the color matching effect on the top and bottom of the screen in 16:9 videos as sometimes it unintentionally cuts of videos. I don't mind my screen turning black in the 16:9 area.
Describe the solution you'd like Option to only apply after the 16:9 ratio in the middle of the screen.
Describe alternatives you've considered Not sure other than disabling it.
Additional context If you watch old video footage even 4:3 and it has the black borders around the film, it cuts off some of the film as it erases the black border.
Thank you!