Skip to content

stream.dash: optional video/audio-only streams #5340

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

Conversation

bastimeyer
Copy link
Member

@bastimeyer bastimeyer commented May 15, 2023

Add with_{video,audio}_only params to DASHStream.parse_manifest() which allow video-only or audio-only streams to be included in the returned streams dict. Both parameters default to false, so only muxed streams with video and audio get returned, just like before.

This is a temporary workaround until a proper stream selection mechanism gets implemented at some point in the future.


Ref #5339

I decided to add the with_ prefix to both parameters, because it makes the intention clearer. Without the prefix, this would imply that muxed streams are not included in the returned streams dict.

$ streamlink 'dash://file://./tests/resources/dash/test_timeline_ids.mpd'
[cli][info] Found matching plugin dash for URL dash://file://./tests/resources/dash/test_timeline_ids.mpd
Available streams: 360p+a48k_alt (worst), 360p+a96k_alt, 360p+a48k, 360p+a96k (best)
$ streamlink 'dash://file://./tests/resources/dash/test_timeline_ids.mpd with_video_only=True'
[cli][info] Found matching plugin dash for URL dash://file://./tests/resources/dash/test_timeline_ids.mpd with_video_only=True
Available streams: 360p_alt (worst), 360p, 360p+a48k_alt, 360p+a96k_alt, 360p+a48k, 360p+a96k (best)
$ streamlink 'dash://file://./tests/resources/dash/test_timeline_ids.mpd with_audio_only=True'
[cli][info] Found matching plugin dash for URL dash://file://./tests/resources/dash/test_timeline_ids.mpd with_audio_only=True
Available streams: a48k (worst), a96k, 360p+a48k_alt, 360p+a96k_alt, 360p+a48k, 360p+a96k (best)
$ streamlink 'dash://file://./tests/resources/dash/test_timeline_ids.mpd with_video_only=True with_audio_only=True'
[cli][info] Found matching plugin dash for URL dash://file://./tests/resources/dash/test_timeline_ids.mpd with_video_only=True with_audio_only=True
Available streams: a48k (worst), a96k, 360p_alt, 360p, 360p+a48k_alt, 360p+a96k_alt, 360p+a48k, 360p+a96k (best)

https://deploy-preview-5340--streamlink.netlify.app/api.html#streamlink.stream.DASHStream.parse_manifest

Add `with_{video,audio}_only` params to `DASHStream.parse_manifest()`
which allow video-only or audio-only streams to be included in the
returned streams dict. Both parameters default to false, so only
muxed streams with video and audio get returned, just like before.

This is a temporary workaround until a proper stream selection mechanism
gets implemented at some point in the future.
@bastimeyer
Copy link
Member Author

Quick note that users do only have access to these params via the DASH plugin itself (dash:// URL scheme or .mpd URL path suffix). Other plugins which return DASH streams need to set these params themselves.

We could however instead add parameters to the session and CLI (e.g. --dash-with-{video,audio}-only), but I'm not really sure if I want that because as said, it's much more of a workaround until a better stream selection gets implemented.

@gravyboat
Copy link
Member

No need to add params since it's a workaround any way.

@gravyboat gravyboat merged commit 7237650 into streamlink:master May 15, 2023
@bastimeyer bastimeyer deleted the stream/dash/video-only-audio-only-streams branch May 15, 2023 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants