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 https://github.com/tonycpsu/mlbstreamer/issues/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.
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 :)
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.
I created a PR for this in #1591 where I kept the API for MuxedHLSStream backwards compatible.
Most helpful comment
I created a PR for this in #1591 where I kept the API for
MuxedHLSStreambackwards compatible.