AVPlayer HLS .m3u8 - could not select audio, subtitle track

Hi gues, I have an issue:

I have m3u8 file format such as:


#EXTM3U
#EXT-X-STREAM-INF:BANDWIDTH=490000,RESOLUTION=640x360
http://XXX.XXX.XX.XXX:31213/MEDIA/76336503.....583609776254/161/4161/
#EXT-X-STREAM-INF:BANDWIDTH=1500000,RESOLUTION=720x576
http://XXX.XXX.XX.XXX:31213/MEDIA/76336503.....583609776254/161/3161/
#EXT-X-STREAM-INF:BANDWIDTH=2500000,RESOLUTION=1280x720
http://XXX.XXX.XX.XXX:31213/MEDIA/76336503.....583609776254/161/2161/

Each EXT-X-STREAM-INF tag link to file like:


#EXTM3U
#EXT-X-TARGETDURATION:5
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:35156
#EXT-X-START:TIME-OFFSET=-25,PRECISE=YES
#EXT-X-KEY:METHOD=AES-128,URI="http:/
#EXTINF:5,
http://XXX.XXX.XX.XXX:02444/xxXXXXX/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/191/2191/aeskey_191_
#EXTINF:5,
http://XXX.XXX.XX.XXX:XXXXX/SSEGMENT/3020314583628416652818934133893/191/2191/seg_XXXXX.ts
#EXTINF:5,
http://XXX.XXX.XX.XXX:XXXXX/SSEGMENT/3020314583628416652818934133893/191/2191/seg_XXXXX.ts
#EXTINF:5,
http://XXX.XXX.XX.XXX:XXXXX/SSEGMENT/3020314583628416652818934133893/191/2191/seg_XXXXX.ts
#EXTINF:5,
http://XXX.XXX.XX.XXX:XXXXX/SSEGMENT/3020314583628416652818934133893/191/2191/seg_XXXXX.ts

Audio and subtitles are embeded in TS file. Since audio/subtitle tracks are not explicitly described in #EXT tag in the above *.m3u8 file, 'mediaSelectionGroupForMediaCharacteristic' returns empty options collection.


In opposite, m3u8 file:

https:/ https://devimages.apple.com.edgekey.net/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8

provided by Apple as an HLS playlist example, has audio/subtitle tracks described in #EXT tags:


#EXTM3U
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="bipbop_audio",LANGUAGE="eng",NAME="BipBop Audio 1",AUTOSELECT=YES,DEFAULT=YES
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="bipbop_audio",LANGUAGE="eng",NAME="BipBop Audio 2",AUTOSELECT=NO,DEFAULT=NO,URI="alternate_audio_aac_sinewave/prog_index.m3u8"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="English",DEFAULT=YES,AUTOSELECT=YES,FORCED=NO,LANGUAGE="en",CHARACTERISTICS="public.accessibility.transcribes-spoken-dialog, public.accessibility.describes-music-and-sound",URI="subtitles/eng/prog_index.m3u8"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="English (Forced)",DEFAULT=NO,AUTOSELECT=NO,FORCED=YES,LANGUAGE="en",URI="subtitles/eng_forced/prog_index.m3u8"

This time 'mediaSelectionGroupForMediaCharacteristic' returns a collection which includes two audio options, which I can select successfully.

THE QUESTION: Is there a way for AVPlayer to select audio/subtitle track, if they are not described in #EXT tag inside *.m3u8 file, but embedded within *.ts files? Thanks ahead, any suggestions are appreciated!

You say: "Audio and subtitles are embeded in TS file"


We only support one audio track in a TS file. If you have multiple audio tracks only one can be in the video. The rest have to be separated out.

The only subtitle format we support (in HLS) is WebVTT. We do not support carriage of WebVTT in TS files. It must be separate.

You can have closed-captions (608 or 708 format) included in the video. Closed captions are the only case where multiple "tracks" are supported. Each must have a unique channel (CC1, CC2, SERVICE1, SERVICE5, etc.)


For the one audio track (or closed captions) included with the video you use an EXT-X-MEDIA tag without a URL.

Any EXT-X-STREAM-INF which references that media tag should include the appropriate track.

AVPlayer HLS .m3u8 - could not select audio, subtitle track
 
 
Q