FreeTubeApp / FreeTube

An Open Source YouTube app for privacy
https://freetubeapp.io/
GNU Affero General Public License v3.0
13.66k stars 864 forks source link

[Feature request] Option to block 60 fps, VP8/VP9, AV1 #504

Open kaypoush opened 4 years ago

kaypoush commented 4 years ago

I have a Chromebook which is not powerful enough to play 60 fps and/or VP8/VP9 videos without stuttering. An option to block them in FreeTube would be nice, something that an extension for browser like h264ify is able to do apparently. By blocking, I don't mean remove all HD options because normal HD videos are playing fine but more something like this: "720p" instead of "720p 60fps" option when choosing the quality, and "h264" instead of "VP8/VP9". It would be very nice for low end computers.

PrestonN commented 4 years ago

This is something that I will try to look into more for the rewrite that I'm working on. Ideally it would be a simple toggle asking if you'd like to use 60fps when available.

In the mean time, if you update your settings to use the legacy player, you will be limited to 720p 30fps which should do what you want. 60fps will also never show up on anything lower than 720p so changing your default quality could help there as well.

kaypoush commented 4 years ago

Thank you! I tried legacy player but it's slower than dash mode I don't know why. My Chromebook (CB3-131) is a potato. Also 480p on YouTube is very bad quality the encoding is poorly done I think. What is weird is I have no issue to play HD videos even 1080p with mpv it's pretty fluid but the youtube on browser is so slow. I heard it's because I don't have hardware acceleration so the CPU is struggling. Anyway.

There is another extension but with more options

https://github.com/alextrv/enhanced-h264ify

Maybe you can look in the code to make your task easier. Thanks again.

rawlife56 commented 3 years ago

Any update on this one ? @PrestonN

GilgusMaximus commented 3 years ago

For the moment no really that much progress here. I'm not too sure how easy this is because we are getting the information from a module and currently they give us 30fps still with vp9. This is mostly due to the fact that once YouTube activate vp9 for a video, they provide at least all resolutions of hd and up in vp9. Additionally we are a bit hindered by our video player's technology, which only supports mp4 formats and not webm formats

PrestonN commented 3 years ago

Since we now have a little more control over the DASH files that are being generated in the rewrite, it should be fairly easy to remove any 60fps options before the DASH file is created. It isn't a high priority at the moment but if someone wants to create a pull request for it then I'll be happy to take a look at it. Let me know if you need any assistance for getting it done.

Albonycal commented 3 years ago

Any updates? Vp9 is very hard on my CPU

PrestonN commented 3 years ago

Give the latest nightly builds a test. 60fps options have been broken out and it should be trivial to select the non-60fps variants of videos now. For this upcoming release, we probably won't have a toggle to prefer 30fps options however the framework is there now to allow it for a release after that.

Ph0rk0z commented 3 years ago

I don't care about 60FPS... needs to be H264 or my GPU can't decode it. Chrome on linux can do it, mpv with ytd can do it. If this can't do it, I can't use it as the cpu usage + temp will be high.

kaypoush commented 2 years ago

I just want to give a feedback on this as the author of this request. 60 fps or not is not important but it could be cool to have that option too if it's possible. My screen is 720p 60 hz so capable of 60 fps I don't remember why I focused on the 60 fps part. My gpu can decode MPEG2, H264 and VC1 according to vainfo. Anything else will be cpu decoded (so video lag if you have a potato chromebook like mine and not good for battery life anyway).

Now I was using freetube with mpv (enabled hw and blocked av1, vp8 and vp9 in mpv.conf) and it was working fine but I didn't like to use two programs to play a video especially when there is a longer delay to start the video from mpv. Then I got va-api working in firefox but it's not correctly working since v98 (rdd sandbox bug). Then I searched for "freetube hardware acceleration" and found about this https://github.com/FreeTubeApp/FreeTube/issues/961 and saw that preston enabled accelerated video feature in electron (chromium) which freetube uses. Then I tested out this based on this https://chromium.googlesource.com/chromium/src/+/master/docs/gpu/vaapi.md and https://wiki.archlinux.org/title/Chromium#Hardware_video_acceleration :

freetube --enable-features=VaapiVideoDecoder --use-gl=egl --disable-features=UseChromeOSDirectVideoDecoder --ignore-gpu-blocklist

(there is also --use-gl=dekstop instead of --use-gl=egl but I didn't notice any difference)

played any video up to 1080p (even in 60 fps to show you why I was wrong by saying that my chromebook had difficulties with 60 fps) (settings for freetube : dash default 1080p) and checked with intel-gpu-top it's correctly working (video is not 0% when playback = gpu decoded).

you can replace the appropriate part with this in your custom freetube.desktop file in ~/.local/share/applications (you can create it as a copy based on the original one located in /usr/share/applications, the custom desktop file will be prioritized):

Exec=/opt/FreeTube/freetube %U --enable-features=VaapiVideoDecoder --use-gl=egl --disable-features=UseChromeOSDirectVideoDecoder --ignore-gpu-blocklist

to start freetube automatically with the right settings.

(By the way, you need VA-API driver installed and package name depends on your gpu and gpu driver used. Mine is libva-intel-driver and I also have this LIBVA_DRIVER_NAME=i965 in my /etc/environment file. Two links that can help for this part: https://wiki.archlinux.org/title/Hardware_video_acceleration#Installation and https://wiki.debian.org/HardwareVideoAcceleration#Installation

So basically anything works fine. The feature request is still useful IMO but not a priority for me at least. Option to block AV1 should be also added to the two I already mentioned. Thanks preston for the great work.

merspieler commented 2 years ago

isn't it possible to differenciate the 720p and 720p60 option in the default resolution setting?

Pentaphon commented 4 weeks ago

Can we do this now that shaka-player is being used? I'd like to block vp9 and av1 for my older laptop.