WesselKroos / youtube-ambilight

This browser extension adds ambient light to YouTube videos
MIT License
78 stars 8 forks source link

Removing bars and "Fill video to screen" does not work on 4:3 videos where YouTube zooms in the video #212

Open zachpoblete opened 5 months ago

zachpoblete commented 5 months ago

Bug description

When in theater mode and "Hide everything in theater mode" is on, toggling "Fill video to screen" seems to have no effect.

Steps to reproduce the behavior

  1. Enter theater mode.
  2. Enable "Enabled."
  3. Enable "Hide everything in theater mode."
  4. Enable "Fill video to screen."
  5. Find that nothing has changed.

Maybe "Fill video to screen" is supposed to work under other conditions, but as a first-time user, I would expect that the setting would definitely work when in theater mode and "Hide everything in theater mode" is on, but still, nothing changes when I toggle "Fill video to screen."

Browser

Chrome, Microsoft Edge, Firefox

Operating system

Windows

Extension version

2.38.1

The bug still happens in these conditions

Additional context and/or screenshots

I would expect that the borders of the video would extend until they hit the borders of the visible page, but there remains space between all the borders.

Screenshot 2024-01-21 01_02_19

Testing on other videos, the other settings under "Remove black & colored bars," e.g. "Remove black bars," seem to work.

WesselKroos commented 5 months ago

"Fill video to screen." only zooms the video to the available space in the video player when black bars are detected and removed.

I can see where the confusion comes from. Renaming the setting seems like a good solution. What name would you suggest for this feature?

zachpoblete commented 5 months ago

Oh, in that case, I would suggest, "Fill video to removed bars."

But hmm, now I've run into a different issue.

I was trying to see if "Fill video to screen" would work for this video ~which has both vertical and horizontal bars.~

However, when I'm in theater mode and enable "Remove black bars," it crops the top and bottom of the video.

"Remove black bars" works in default mode, but "Fill video to screen" isn't doing anything.

Mode "Remove black bars" $\color{Red}{\textsf{OFF}}$ ("Fill video to screen" on) "Remove black bars" $\color{Green}{\textsf{ON}}$ ("Fill video to screen" on)
Theater image image
Default image image

Is "Remove black bars" cropping the top and bottom of the video a new issue?

WesselKroos commented 5 months ago

work for this video which has both vertical and horizontal bars.

Interesting... It looks like YouTube is cropping top and bottom black bars on videos with an aspect ratio of 4:3 by themselves now? That's new, and seems to cause the video to be moved down instead. Btw, the source video has only black bars at the top and the bottom, not on the sides.

Anyway, here is a video on which it still correctly works: https://www.youtube.com/watch?v=oSxqkER3N6Y Original Removed black bars Removed black bars + fill to screen
image image image
zachpoblete commented 5 months ago

By the way, what's an example of colored bars being removed?

WesselKroos commented 5 months ago

It's most often usefull for videos with white bars https://www.youtube.com/watch?v=O1LPzQsty8U And there are also old videos with grey bars or you could encounter music videos with colored bars.

zachpoblete commented 5 months ago

Ah, I see. I was confused as to why it didn't do anything for this video, but now I understand it's for whites and grays.

Is a delay in removing the bars to be expected whenever the bar size changes?

WesselKroos commented 5 months ago

It also works on colored bars. But it does not work on that video because it has large vertical and horizontal bars. Because there is no distinction between the horizontal and vertical bars in the corners.

Yes, it throttles detection for an x amount of frames to prevent false-positives. Like a concert video shot that pans upwards a rectangle stage where, at night, the sky and the crowd can both be black.

You can turn down the delay though, by turning down the average frames in the advanced bar settings.

zachpoblete commented 5 months ago

There seems to be a false positive in this video when enabling "Remove black sidebars" along with "Also remove colored bars."

After the video pans to the right from 1:11–1:12, the gray backgrounds of Premiere are mistaken for bars even though there are UI elements in the portions that are being cropped.

Original Remove sidebars ON
image image
WesselKroos commented 5 months ago

That's because of the small blue line on the left side. There will be many more false-positives with colored bar detection on.

WesselKroos commented 4 months ago

Styling these kind of videos seems to be more difficult than expected.

WesselKroos commented 1 month ago

There seems to be a false positive in this video when enabling "Remove black sidebars" along with "Also remove colored bars."

That's because of the small blue line on the left side. There will be many more false-positives with colored bar detection on.

@zachpoblete Since #225 has been released in 2.38.2 it is now possible to tune the aggressiveness of the bar removal feature via the "Detection: Ignored elements" slider.

WesselKroos commented 16 hours ago

Apparently YouTube zooms in on a video in theater view when it has a yt:crop value in it's keywords. https://youtu.be/RyVXzzXP7Jg has a yt:crop value of 16:9 <meta name="keywords" content="keywoord1, ..., yt:crop=16:9">

Removing that keyword from the player's internal list of keywords via the updateVideoData function, when the ambient light is enabled, seems to workaround this problem: document.querySelector('#movie_player').updateVideoData({ keywords: "keyword1,..." })