iv-org / invidious

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

[Enhancement] adding 30fps/60fps frame rate selection for 720p dash #2988

Open rezad1393 opened 2 years ago

rezad1393 commented 2 years ago

Is your enhancement request related to a problem? Please describe.

yes. the problem is with my internet bandwidth. I don't have much of it so when I use invidious to watch youtube videos, I limit the video to 480p dash, but many of the videos are a bit blurry and small text becomes a bit hard to read. so I want to go to 720p.

right now invidious doesn't support anything other than h264 it seems (or the video player that invidious uses doesn't support it) so size of videos is already bigger than youtube own player (because youtube uses vp9 and av1 way more than h264) when I watch a video that is ,say 118MB in size at 480p-h264, if I want to watch it at 720p-h264 then it size becomes 342MB for 30fps and 534MB for 60fps.

my laptop supports 60fps but I don't need that frame rate just 720p resolution. I see that invidious uses the 60pfs one. so I want to watch the video at 720p-30fps. this way I can watch it without saturating my bandwidth and also when using proxy-video feature, the invidious instance is also less burdened with my download.

Describe the solution you'd like

if I understand correctly youtube only has this dual frame rate support only at 720p dash. so in options instead of 720p dash, put two options :720p-30fps and 720p-60fps

this maybe a edge case but it would help a lot.

SamantazFox commented 2 years ago

I feel your pain. Sadly, on many videos (if not the majority?), only 60FPS is available, and we can't fall back to 30FPS.

For instance, on the latest video from PewDiePie, the quality jumps from 480p to 720p60:

{
    "adaptiveFormats": [
        {
            "itag": "135",
            "type": "video/mp4; codecs=\"avc1.4d401f\"",
            "fps": 30,
            "container": "mp4",
            "encoding": "h264",
            "qualityLabel": "480p"
        },
        {
            "itag": "244",
            "type": "video/webm; codecs=\"vp9\"",
            "fps": 30,
            "container": "webm",
            "encoding": "vp9",
            "qualityLabel": "480p"
        },
        {
            "itag": "298",
            "type": "video/mp4; codecs=\"avc1.4d4020\"",
            "fps": 60,
            "container": "mp4",
            "encoding": "h264",
            "qualityLabel": "720p60"
        },
        {
            "itag": "302",
            "type": "video/webm; codecs=\"vp9\"",
            "fps": 60,
            "container": "webm",
            "encoding": "vp9",
            "qualityLabel": "720p60"
        },
        {
            "itag": "299",
            "type": "video/mp4; codecs=\"avc1.64002a\"",
            "fps": 60,
            "container": "mp4",
            "encoding": "h264",
            "qualityLabel": "1080p60"
        },
        {
            "itag": "303",
            "type": "video/webm; codecs=\"vp9\"",
            "fps": 60,
            "container": "webm",
            "encoding": "vp9",
            "qualityLabel": "1080p60"
        }
    ],
}

(This is taken from https://test.invidious.io/api/v1/videos/JIz0-6_mPIE, from which I remove all the useless bits)

rezad1393 commented 2 years ago

is that because 60 is higher than 30 in terms of ranking of quality and invidious ranks high to low so I cant set default as 720p-30 cause some videos that only have 720p-60 then will go to 480p ? because right now the set resolution worked like this and if 720p in not found it would as you say "fall back" to 480 and so on.

also the video you tested absolutely does have 30fps.

itag | "22"
type | "video/mp4; codecs=\"avc1.64001F, mp4a.40.2\""
quality | "hd720"
fps | 30
container | "mp4"
encoding | "h264"
resolution | "720p"
qualityLabel | "720p"
size | "1280x720"

are you sure than videos can have 720p-60 but not 720-30? not only does it have 720p-30fps it also has it in vp9. I test that with jdownloader.

I think those two are the set than google trans-code to for 720p. and as I said this is only for 720p that google decided to do this (basically a stopgap for devices that are old but not sd) so you have two set , one that are SD (480 and lower) which are all 30fps. and another that are all fullhd and higher which are all 60 (as in they don't get trans-coded to 30). the overlap is 720p.

I know my case is a edge case but I dont think it is that much of edge case as google literally uses a video format just for this issue. I mean they have literally only one non-dash default case and that is 720p-30 .though that is useless for me cause in firefox non -dash videos get pre-downloaded for all its length and just uses my data (that is the only reason why I uses dash, as without this there is no reason to use dash for under HD quality as webm and av1 are not supported on invidious anyway)

rezad1393 commented 2 years ago

Sadly, on many videos (if not the majority?), only 60FPS is available, and we can't fall back to 30FPS.

are you sure? I have searched and the opposite is true.

youtube does video like this: under 720 --> 30(or 25) fps 1080p and higher --> only 60fps (or higher?)

and for 720: both 30fps(or lower) and 60 if 60 is available. like this https://www.youtube.com/watch?v=2p0o2PFvwyk that has h264 in 720p @ 25fps and 50fps. and this is done for both h264 and vp9 codec on 720p that has 60fps. so basically is the video has h264@60fps then it has h264@30fps. this is for compatibility sake. I don't know why that piedipie video doesn't have 720p30 in list returned by invidious link but it is there on youtube and you can test with jdownloader and download it. so maybe the invidious has a bug that at 720p just returned 60fps.

for example this video: https://www.youtube.com/watch?v=xVMZpLpRF7c has the vp9 at 30 and 60fps and also h264 at 30 and 6 fps and also a 30fps non-dash h264.

even a 8k video like this has both 30 and 60fps at 720p: https://www.youtube.com/watch?v=1La4QzGeaaQ

please reconsider implementing this.

this video https://www.youtube.com/watch?v=xVMZpLpRF7c size for h264 are like this: 480 (so 30fps) 164MB 720@30 298MB 720@60 418MB

so a 40% increase in file size.

this would also help with instance bandwidth.