-
Notifications
You must be signed in to change notification settings - Fork 864
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support multiple audio tracks and AV1 for Invidious by using the local API DASH manifest generator #3942
Support multiple audio tracks and AV1 for Invidious by using the local API DASH manifest generator #3942
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that the test videos didnt start in the original track by default. The Local API always starts with the original track.
Is this intended behavior?
It should start with the default one, was messing around a lot in FreeTube and YouTube.js while making it, so maybe I broke something along the way or maybe it's dependant on one of the YouTube.js changes I made while making this. I'll take a look and get back to you. |
8c7368d
to
9ae58c2
Compare
@efb4f5ff-1298-471a-8973-3d47447115dc Should work now, created a pull request to YouTube.js with the bug fix and upgraded to the version with it now. |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Conflicts have been resolved. A maintainer will review the pull request shortly. |
Added language names with the Intl.DisplayNames API, so now the labels match the local API ones. This means they should now look and feel the same. |
|
||
if (hasMultipleAudioTracks) { | ||
// match YouTube's local API response with English | ||
const languageNames = new Intl.DisplayNames('en-US', { type: 'language' }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we use the user's current locale instead of using "en-US"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My goal with this pull request was to match the local API, so that you would have the same, identical user experience with both the local and the Invidious API (maybe I should have made the comment on the line above more clear).
If you want me to switch to using the users locale, I can do that, it'll just be a different user experience than with the local API or the Invidious API when it gets multiple audio track support (ideally we don't want to keep this hack around forever).
So tested both videos again and both didnt start with the original audio |
@efb4f5ff-1298-471a-8973-3d47447115dc Merged the development branch in again, hopefully that'll help, also make sure you have ran |
Co-authored-by: ChunkyProgrammer <78101139+ChunkyProgrammer@users.noreply.github.com>
Fixed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, looked at XHR/Fetch in network tab and no requests to YouTube are made when proxying through invidious is enabled. We should probably be translating the languages to the user's locale but as local api doesn't currently do that, this can come later
* development: (41 commits) Translated using Weblate (Finnish) Mobile/tablet channel page & share button visual improvements (FreeTubeApp#4061) Support multiple audio tracks and AV1 for Invidious by using the local API DASH manifest generator (FreeTubeApp#3942) Normalize ft-list-item grid height (FreeTubeApp#4043) Bump the stylelint group with 1 update (FreeTubeApp#4071) Bump the babel group with 1 update (FreeTubeApp#4069) Bump the eslint group with 1 update (FreeTubeApp#4070) Bump sass from 1.67.0 to 1.68.0 (FreeTubeApp#4072) Bump marked from 9.0.2 to 9.0.3 (FreeTubeApp#4073) Bump lefthook from 1.4.11 to 1.5.0 (FreeTubeApp#4074) Translated using Weblate (Chinese (Traditional)) Translated using Weblate (Greek) Translated using Weblate (German) Translated using Weblate (Portuguese (Brazil)) Translated using Weblate (French) Translated using Weblate (Icelandic) Translated using Weblate (Portuguese) Translated using Weblate (Polish) ! Fix in sub view, restoring last tab is bugged when visible tabs do not include tab to be restored (FreeTubeApp#4064) Translated using Weblate (Ukrainian) ... # Conflicts: # src/renderer/components/ft-prompt/ft-prompt.css
* feature/playlist-2023-05: (176 commits) ! Fix playlist item fetching for local API (FreeTubeApp#4102) ! Fix watch page video published time parsing (FreeTubeApp#4105) Translated using Weblate (Serbian) Bump youtubei.js from 6.4.0 to 6.4.1 (FreeTubeApp#4090) Bump rimraf from 5.0.1 to 5.0.5 (FreeTubeApp#4091) Bump the stylelint group with 2 updates (FreeTubeApp#4088) Bump electron from 22.3.24 to 22.3.25 (FreeTubeApp#4089) Translated using Weblate (Bulgarian) Update FT history import to accept key lastViewedPlaylistId (FreeTubeApp#4038) ! Fix ft-video having different URLs in links Translated using Weblate (Dutch) Translated using Weblate (Lithuanian) Translated using Weblate (Japanese) Translated using Weblate (Croatian) Translated using Weblate (Estonian) Translated using Weblate (Croatian) ! Fix external player handling for video in local playlist Translated using Weblate (Finnish) Mobile/tablet channel page & share button visual improvements (FreeTubeApp#4061) Support multiple audio tracks and AV1 for Invidious by using the local API DASH manifest generator (FreeTubeApp#3942) ...
Support multiple audio tracks and AV1 for Invidious by using the local API DASH manifest generator
Pull Request Type
Related issue
closes #3382
Description
Currently Invidious doesn't support multiple audio tracks in their API response or DASH manifest, they are also missing the important fields
width
,height
for all video streams andfps
andqualityLabel
for the AV1 formats in their API responses.This pull request adds multiple audio track support for Invidious, without requiring any changes on their side, a side effect of that ,is that we can also support AV1 formats properly for Invidious.
This pull request takes advantage of YouTube.js exposing its DASH manifest generator and its ability to parse language and role information from the streaming URLs. Unfortunately due to the missing fields in the API responses (mentioned in the first paragraph), this pull request still makes a request to Invidious' manifest endpoint, so that it can extract the height, width and fps from it, for the locally generated manifest. As video.js was already making that request before, this doesn't cause any extra load on Invidious instances.
YouTube.js usually deciphers the formats as part of the manifest generation process, as that requires sending a request to YouTube to check if there is a new player and a second one to fetch it if there is (would use the one from the cache if it's the same one), I decided to make the deciphering a no-op while generating the Invidious manifest (it will still decipher for the local API one).
While we could use the deciphering to unthrottle age-restricted videos on Invidious (Invidious doesn't do its own deciphering and the bypass doesn't use the android endpoint, with the magic params that bypass throttling), I decided against it, to avoid making the extra requests. If unthrottling those is still desirable, I could see if there is a way to detect age restricted videos on Invidious and implement deciphering just for those ones (only if backend fallback is enabled of course) in a follow-up pull request.
Testing
dubbed and descriptive audio tracks: https://youtu.be/Kn56bMZ9OE8 (dubbed at 1:35, descriptive at 1:40)
audio tracks in multiple languages: https://youtu.be/jObOjhUkf50
AV1 formats: https://youtu.be/njX2bu-_Vw4
Also test proxying if you can find an Invidious instance it works on.
Desktop