shaka-project / shaka-streamer

A simple config-file based approach to preparing streaming media, based on FFmpeg and Shaka Packager.
https://shaka-project.github.io/shaka-streamer/
Apache License 2.0
198 stars 62 forks source link

Multiple audio codecs in HLS output can't be played in Shaka Player #18

Closed joeyparrish closed 3 years ago

joeyparrish commented 5 years ago

It's not yet clear if this should be restricted in Streamer, tweaked in Packager, or improved in Player.

For now, restrict yourself to aac for HLS.

joeyparrish commented 3 years ago

Packager's dash_only=1 should solve this: https://google.github.io/shaka-packager/html/tutorials/dash.html

Not sure if we should hard-code a dash_only=1 on WebM-format outputs (much simpler), or if we should make dash_only configurable in the bitrate/codec configs (more extensible).

CaitlinOCallaghan commented 3 years ago

@joeyparrish, to clarify, if the pipeline config includes the following:

# The codecs to encode with.
audio_codecs:
  - aac
  - ac3
  - opus
video_codecs:
  - h264
  - vp9

# Manifest format (dash, hls or both)
manifest_format:
  - dash
  - hls

Shaka Player will not be able to properly handle the HLS stream? So, we would want something like this to restrict HLS to only aac:

# The codecs to encode with.
audio_codecs:
  aac:
    dash_only: False
  ac3:
    dash_only: True
  opus:
    dash_only: True
video_codecs:
  - h264
  - vp9

# Manifest format (dash, hls or both)
manifest_format:
  - dash
  - hls 

If we go with the configurable approach, do we want to allow users be able to restrict any codec to "dash_only", or just opus since it's the only one that maps to a webm formatted output?

joeyparrish commented 3 years ago

Shaka Player will not be able to properly handle the HLS stream?

That was once true. I believe Shaka Player now filters out such streams from HLS (though I can't remember the details). But Shaka Streamer does not require Shaka Player, so we should not put WebM streams into HLS.

I think the simplest answer is just to put dash_only=1 into the Packager command for WebM output. That would not require any configuration.

If we want to make it configurable, something like you suggested might work. But I'm not 100% sure it's worth the effort. What do you think?

CaitlinOCallaghan commented 3 years ago

I think that hard coding dash_only=1 within the packager node is probably the best approach for now. It's a bit confusing to expose the "dash_only" option in the config - I don't think users would understand the purpose of the option until they dig deeper and discover Player's HLS limitation.

Plus, if Player improves to allow multiple audio codecs in an HLS output, then removing the "dash_only=1" would be simpler than reverting the configs and their associated logic.

joeyparrish commented 3 years ago

Good point. Thanks!