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

HLS with multiple audio streams #1588

Closed
mattiasa opened this issue Apr 4, 2018 · 3 comments
Closed

HLS with multiple audio streams #1588

mattiasa opened this issue Apr 4, 2018 · 3 comments

Comments

@mattiasa
Copy link
Contributor

mattiasa commented Apr 4, 2018

The HLS support in Streamlink currently allows me to select an alternate audio stream with --hls-audio-select but that only allows me to select one audio stream.

As part of our work on tonycpsu/mlbstreamer#1 we would like to download all audio streams and mux them together into one file, which allows the user to select between the available audio streams in both VLC and mplayer.

This is an example playlist which I would like to handle:

#EXTM3U
#EXT-X-INDEPENDENT-SEGMENTS
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",LANGUAGE="en",NAME="English",AUTOSELECT=YES,DEFAULT=YES
#EXT-X-MEDIA:TYPE=CLOSED-CAPTIONS,GROUP-ID="cc",LANGUAGE="en",NAME="English",INSTREAM-ID="CC1"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",NAME="Natural Sound",LANGUAGE="zxx",AUTOSELECT=NO,URI="ballpark_48K/48_complete-trimmed.m3u8"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",NAME="English Radio",LANGUAGE="en",AUTOSELECT=NO,URI="eng_48K/48_complete-trimmed.m3u8"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",NAME="Radio Española",LANGUAGE="es",AUTOSELECT=NO,URI="spa_48K/48_complete-trimmed.m3u8"

I have successfully patched hls.py to pass all the audio streams to MuxedHLSStream() and would like to add this as an option to Streamlink. Would you be willing to add this if I create a PR?

I see two alternatives. Either I add a new command line option or I add a special keyword (for example ALL) as an option to --hls-audio-select which triggers this special case. I'm not sure which option you would prefer and would like some guidance.

@beardypig
Copy link
Member

Sure, I'd be will to review it and help get the feature added.
Maybe providing a list to --hls-audio-select would work, you could also add * if you wanted to include them all (this is a pattern used in other arguments). If you need any assistance let me know :)

@mattiasa
Copy link
Contributor Author

mattiasa commented Apr 4, 2018

Thanks! Exactly the kind of feedback and direction I wanted to get before starting. I like the idea of using a list.

I assume that MuxedHLSStream is considered an internal class in src/streamlink/stream/hls.py so it's ok to change the method signature of init to take a list of audio tracks rather than just one?
Nothing else in the code base references this class.

@mattiasa
Copy link
Contributor Author

mattiasa commented Apr 4, 2018

I created a PR for this in #1591 where I kept the API for MuxedHLSStream backwards compatible.

@back-to back-to closed this as completed Apr 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants