Skip to content
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

Improve audio stream selection for video-only streams in the downloader #10446

Merged

Conversation

AudricV
Copy link
Member

@AudricV AudricV commented Sep 24, 2023

What is it?

  • Bugfix (user facing)

Description of the changes in your PR

Instead of searching for the first audio stream compatible with a media format, this change makes the method to get audio-only streams for video-only streams in the downloader (SecondaryStreamHelper.getAudioStreamFor) use some methods used to get available audio streams for playback (isLimitingDataUsage, getAudioFormatComparator and getAudioIndexByHighestRank of ListHelper class).

This means that the audio stream quality selection in the downloader will now follow the setting of a default video resolution on mobile data: if a resolution is set, the lowest audio stream should be selected, otherwise the highest audio stream should be selected. This behavior should be already applied for playback.

Fixes the following issue(s)

APK testing

The APK can be found by going to the "Checks" tab below the title. On the left pane, click on "CI", scroll down to "artifacts" and click "app" to download the zip file which contains the debug APK of this PR. You can find more info and a video demonstration on this wiki page.

Due diligence

Instead of searching for the first audio stream matching a compatible media
format, this change makes SecondaryStreamHelper.getAudioStreamFor use methods
isLimitingDataUsage, getAudioFormatComparator and getAudioIndexByHighestRank of
ListHelper to get an audio stream which can be muxed into a video-only stream,
if available.

This allows users to download videos with the highest audio quality available
if no resolution limit on mobile data usage has been set.

The order of formats used to search a compatible audio stream has been kept.
@AudricV AudricV added bug Issue is related to a bug downloader Issue is related to the downloader labels Sep 24, 2023
@sonarcloud
Copy link

sonarcloud bot commented Sep 24, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@TobiGr
Copy link
Member

TobiGr commented Sep 25, 2023

Please add information about the strategy that is used to get the AudioStream to the method. That should help us to easily determine whether to use the method and/or how to modify it if the requirements change in the future.

@Stypox Stypox mentioned this pull request Nov 16, 2023
21 tasks
Copy link
Member

@Stypox Stypox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Videos are usually downloaded to be kept for later, so most of the times the audio quality the user wants is unrelated to whether they are connected to mobile data or not. The optimal way would be to add a secondary menu in the download dialog for choosing the audio quality separately. But for now this is ok.

Copy link
Member

@Stypox Stypox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested by downloading a video under wifi and under mobile data with the setting on, and they turned out to have two different sizes, so I guess it counts as a succeeded test. Thanks!

@Stypox Stypox merged commit e784af3 into TeamNewPipe:dev Dec 7, 2023
1 of 7 checks passed
@AudricV AudricV deleted the dl_improve_video_audio_stream_selection branch December 7, 2023 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is related to a bug downloader Issue is related to the downloader
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Newpipe using lower quality 48 kbps aac audio for video downloads
3 participants