iv-org / invidious

Invidious is an alternative front-end to YouTube
https://invidious.io
GNU Affero General Public License v3.0
16.04k stars 1.77k forks source link

[Enhancement-Bug] videojs doesn't support WEBM - DASH max quality selectable is 1080p, whereas on YT 2160p #3677

Open gauner1986 opened 1 year ago

gauner1986 commented 1 year ago

EDIT by @unixfox

YouTube started for recent videos to only offer qualities over 1080p through the video format WEBM, but video.js doesn't support WEBM so the invidious users can't watch recent videos with a quality over 1080p.


Describe the bug

I configured my own private instance (2023.02.22-0995e044 @ master), but this issue is also reproducible on a public instance like yewtu.be. When DASH is used max quality selectable on some videos is 1080p, whereas on YT itself 2160p is selectable.

2160p is provided as a download quality though.

Steps to Reproduce Issue is reproducible with:

https://yewtu.be/watch?v=QBUpQEsfsz4

Make sure DASH is selected as preferred video quality in settings

Hit play, go to the quality selector and find all resolutions up to 1080p with no >1080p res shown.

Whereas for https://yewtu.be/watch?v=ZrasHxMdZgI 2160p IS shown

unixfox commented 1 year ago

This is because for most of the recent videos, youtube only offer the qualities over 1080p through the codec WEBM and videojs, the video player of invidious, doesn't support WEBM. So unfortunately at the moment you will be limited to 1080p max on invidious for some videos.

Please see for more details:

There was a discussion if we should switch to other video players: https://github.com/iv-org/invidious/issues/3241#issuecomment-1206776445

absidue commented 1 year ago

@unixfox YouTube does offer qualites above 1080p for the MP4 streams but only the MP4 AV1 ones, the MP4 h264 ones are limited to 1080p. I assume that Invidious is either filtering out the AV1 formats or YouTube's InnerTube API doesn't return them for the android client that Invidious is pretending to be.

mckennajones commented 7 months ago

Hi, any developments here @unixfox ? Is an upgrade to videojs still the limiting factor?

unixfox commented 7 months ago

Hi, any developments here @unixfox ? Is an upgrade to videojs still the limiting factor?

No upstream videojs doesn't support yet webm.

mckennajones commented 7 months ago

Hi @unixfox, I'm by no means an expert on web video, but I've been reading up on videojs and I'm not sure if that is accurate. My understanding is that videojs simply decorates the standard HTML5 <video> element. So, video container support is actually determined by your browser. I'm fairly certain that most if not all modern browsers support webm. Mozilla has a table here showing support for WebM across browsers.

Most of the videojs examples I see also reference webm sources.

Thoughts?

absidue commented 7 months ago

@mckennajones That is only accurate if you are passing the file directly to the browser, DASH playback requires JavaScript code to combine the separate audio and video streams before passing it to the browser and video.js's JavaScript only supports MP4 DASH.

The only two streams that YouTube offers that are combined are a 360p and 720p one, both are limited to SDR colors, stereo audio and maximum 30fps.

The rest of them are DASH, so audio only and video only streams that need to be combined at playtime. The idea behind it is that the player can dynamically switch between different audio and video qualities, depending on the network conditions and how powerful the device is (manual quality selection goes against the intentions of the DASH specification, but is wanted by users, which is why many players allow you to switch away from the "auto" quality).

mckennajones commented 7 months ago

Got it! Thanks for the clarification @absidue. I see now that the video.js http-streaming module depends heavily on parsing the MP4s, hence no support for WebM.

dash.js, the reference player for DASH does support WebM. You can add it on top of video.js, suggested in a comment here. Would we consider this approach?

unixfox commented 7 months ago

Please understand that I have spent countless hours trying to find a solution for WEBM on videojs so you can be sure that we have tried the different solutions proposed that are more than 6 months old.

None of them works for videojs directly, as you can even see I replied to the github issue that you linked.

But I have proposed in the past to investigate a potential usage of another library called shakajs: https://github.com/iv-org/invidious/issues/3993

If you have some free time feel free to test that! I have personally not because I lack of free time for that.