shaka-project / shaka-packager

A media packaging and development framework for VOD and Live DASH and HLS applications, supporting Common Encryption for Widevine and other DRM Systems.
https://shaka-project.github.io/shaka-packager/
Other
2k stars 510 forks source link

HLS Set Default=NO #1169

Closed sarge closed 1 year ago

sarge commented 1 year ago

System info

Operating System:OSX Shaka Packager Version: v1.6.1

Issue and steps to reproduce the problem

Despite the HLS Specification clearly stating that setting DEFAULT=NO is the default. We notice that when setting a --default_language HLS players will still select non default languages - iPhone 16.1

I am proposing that we explicitly set the DEFAULT=NO in all cases. This seems to be what other multiple audio examples do.

https://bitmovin.com/demos/multi-audio-tracks https://cdn.bitmovin.com/content/assets/sintel/hls/playlist.m3u8

https://www.radiantmediaplayer.com/docs/latest/gist/multi-audio/ https://5b44cf20b0388.streamlock.net:8443/vod/smil:hls-maudios-prod.smil/playlist.m3u8

Packager Command:

/usr/bin/packager --temp_dir temp  
'in=main-eng-Englis-stereo.mp4,lang=eng,stream=audio,output=output/hls/main-eng-Englis-stereo_audio.mp4,drm_label=2d19c5cbdb6547cc824f2a16d8ddbf5a,hls_group_id=audio_aac,dash_roles=main,hls_name=English,dash_label=English' 
'in=main-eng-Englis-5_1_side_.mp4,lang=eng,stream=audio,output=output/hls/main-eng-Englis-5_1_side__audio.mp4,drm_label=bf952037e8dc4183b09af4834c275ca2,hls_group_id=audio_ac3,dash_roles=main,hls_name=English,dash_label=English'
'in=main-spa-Espa_o-stereo.mp4,lang=spa,stream=audio,output=output/hls/main-spa-Espa_o-stereo_audio.mp4,drm_label=c22cd84dc3e440aab74dd574841f2660,hls_group_id=audio_aac,dash_roles=main,hls_name=Español,dash_label=Español' 
'in=432_main_730.mp4,lang=eng,stream=video,output=output/hls/432_main_730_video.mp4,drm_label=8403196bcfdd4ef1ba37ac2fe9343a2e,playlist_name=432_main_730_video.m3u8,iframe_playlist_name=432_main_730_video_iframes.m3u8' 
 --hls_master_playlist_output output/hls/multiple_audio.m3u8 
 --default_language eng
#EXTM3U
## Generated with https://github.com/shaka-project/shaka-packager version 10c6e80226-release

#EXT-X-INDEPENDENT-SEGMENTS

#EXT-X-MEDIA:TYPE=AUDIO,URI="stream_2.m3u8",GROUP-ID="audio_aac",LANGUAGE="en",NAME="English",DEFAULT=YES,AUTOSELECT=YES,CHANNELS="2"
#EXT-X-MEDIA:TYPE=AUDIO,URI="stream_3.m3u8",GROUP-ID="audio_aac",LANGUAGE="es",NAME="Español",AUTOSELECT=YES,CHANNELS="2"
#EXT-X-MEDIA:TYPE=AUDIO,URI="stream_1.m3u8",GROUP-ID="audio_ac3",LANGUAGE="en",NAME="English",DEFAULT=YES,AUTOSELECT=YES,CHANNELS="6"

#EXT-X-STREAM-INF:BANDWIDTH=376307,AVERAGE-BANDWIDTH=280615,CODECS="avc1.4d4016,mp4a.40.2",RESOLUTION=640x480,FRAME-RATE=8.000,AUDIO="audio_aac",CLOSED-CAPTIONS=NONE
432_main_730_video.m3u8

#EXT-X-STREAM-INF:BANDWIDTH=619298,AVERAGE-BANDWIDTH=564627,CODECS="avc1.4d4016,ac-3",RESOLUTION=640x480,FRAME-RATE=8.000,AUDIO="audio_ac3",CLOSED-CAPTIONS=NONE
432_main_730_video.m3u8

#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=59227,AVERAGE-BANDWIDTH=40119,CODECS="avc1.4d4016",RESOLUTION=640x480,CLOSED-CAPTIONS=NONE,URI="432_main_730_video_iframes.m3u8"

Extra steps to reproduce the problem? (1) (2)

What is the expected result?

EXTM3U

Generated with https://github.com/shaka-project/shaka-packager version 10c6e80226-release

EXT-X-INDEPENDENT-SEGMENTS

EXT-X-MEDIA:TYPE=AUDIO,URI="stream_3.m3u8",GROUP-ID="audio_aac",LANGUAGE="es",NAME="Español",DEFAULT=NO,AUTOSELECT=YES,CHANNELS="2"

EXT-X-MEDIA:TYPE=AUDIO,URI="stream_2.m3u8",GROUP-ID="audio_aac",LANGUAGE="en",NAME="English",DEFAULT=YES,AUTOSELECT=YES,CHANNELS="2"

EXT-X-MEDIA:TYPE=AUDIO,URI="stream_1.m3u8",GROUP-ID="audio_ac3",LANGUAGE="en",NAME="English",DEFAULT=YES,AUTOSELECT=YES,CHANNELS="6"

EXT-X-STREAM-INF:BANDWIDTH=376307,AVERAGE-BANDWIDTH=280615,CODECS="avc1.4d4016,mp4a.40.2",RESOLUTION=640x480,FRAME-RATE=8.000,AUDIO="audio_aac",CLOSED-CAPTIONS=NONE

432_main_730_video.m3u8

EXT-X-STREAM-INF:BANDWIDTH=619298,AVERAGE-BANDWIDTH=564627,CODECS="avc1.4d4016,ac-3",RESOLUTION=640x480,FRAME-RATE=8.000,AUDIO="audio_ac3",CLOSED-CAPTIONS=NONE

432_main_730_video.m3u8

EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=59227,AVERAGE-BANDWIDTH=40119,CODECS="avc1.4d4016",RESOLUTION=640x480,CLOSED-CAPTIONS=NONE,URI="432_main_730_video_iframes.m3u8"

The default audio is played on native Apple Controls.

What happens instead?

Non default Audio is played.

vish91 commented 1 year ago

As you mentioned this seems to go against what HLS spec defines DEFAULT as.

This attribute is OPTIONAL.  Its absence
      indicates an implicit value of NO.

Curious if you opened an issue or brought it up on shaka-player or other player forums ?

Even if we had to do this, would probably bring it up with Shaka Packager maintainers if this is the safest backwards compatible way to do this or for users who explicitly want this feature should be made into like an optional stream descriptor tag. ? 🤷🏽

Perhaps what you need is a combination of DEFAULT an AUTOSELECT values https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis#section-4.4.6.1

AUTOSELECT The value is an enumerated-string; valid strings are YES and NO. This attribute is OPTIONAL. Its absence indicates an implicit value of NO. If the value is YES, then the client MAY choose to play this Rendition in the absence of explicit user preference because it matches the current playback environment, such as chosen system language. If the AUTOSELECT attribute is present, its value MUST be YES if the value of the DEFAULT attribute is YES.