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

opus not included in hls master file #141

Closed Chokoabigail closed 10 months ago

Chokoabigail commented 11 months ago

When I encode the following in the output config file:

streaming_mode: vod

# A list of resolutions to encode.
# For VOD, you can specify many more resolutions than you would with live,
# since the encoding does not need to be done in real-time.
resolutions:
  - 1080p
  - 720p
  - 360p

# A list of channel layouts to encode.
channel_layouts:
  - stereo
  - surround

# The codecs to encode with.
audio_codecs:
  - opus
  - aac

video_codecs:
  - h264

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

# Length of each segment in seconds.
segment_size: 2

# Forces the use of SegmentTemplate in DASH.
segment_per_file: True

The opus is not put on the manifest file of the HLS, here is a manifest example:

#EXTM3U
#EXT-X-INDEPENDENT-SEGMENTS
#EXT-X-MEDIA:TYPE=AUDIO,URI="stream_2.m3u8",GROUP-ID="default-audio-group",NAME="stream_2",AUTOSELECT=YES,CHANNELS="2"
#EXT-X-STREAM-INF:BANDWIDTH=1525725,AVERAGE-BANDWIDTH=540700,CODECS="avc1.4d401e,mp4a.40.2",RESOLUTION=640x360,FRAME-RATE=24.000,AUDIO="default-audio-group",CLOSED-CAPTIONS=NONE
stream_3.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=5276469,AVERAGE-BANDWIDTH=2141435,CODECS="avc1.64001f,mp4a.40.2",RESOLUTION=1280x720,FRAME-RATE=24.000,AUDIO="default-audio-group",CLOSED-CAPTIONS=NONE
stream_0.m3u8

As you can see only aac got in the master playlist (As far as I understand there is support for Opus in mp4 and in HLS)

joeyparrish commented 11 months ago

I believe this is working as intended so long as we put Opus inside WebM. Most players can't handle WebM in HLS.

I believe we could change Streamer to package Opus inside MP4 instead. See https://github.com/shaka-project/shaka-streamer/blob/2cee26b9254dbc819ebeae984d38622c4137b544/streamer/bitrate_configuration.py#L64

PRs are always welcome!

Chokoabigail commented 10 months ago

Thanks, I submitted the PR