Search code examples
videovideo-streamingvideo-processinghttp-live-streamingshaka

Shaka packager with hls and dolby vision


I have an mp4 with Dolby Vision that I am trying to create an HLS stream out of. To do so I am passing this mp4 to shaka packager like so:

packager in=dolby-vision-amaze.mp4,stream=video,segment_template=video1/$Number$.ts,iframe_playlist_name=h265_1920p/iframe1.m3u8

I can extract the audio with this command here:

packager in=dolby-vision-amaze.mp4,stream=audio,segment_template=audio1/$Number$.ts,iframe_playlist_name=h265_360p/iframe1.m3u8

But with the video command I get this error:

[0516/220127:INFO:demuxer.cc(89)] Demuxer::Run() on file 'dolby-vision-amaze.mp4'.
[0516/220127:INFO:demuxer.cc(155)] Initialize Demuxer for file 'dolby-vision-amaze.mp4'.
[0516/220127:ERROR:pes_packet_generator.cc(47)] NOT IMPLEMENTEDVideo codec 103 is not supported.
[0516/220127:ERROR:mp4_media_parser.cc(889)] Failed to process the sample.
[0516/220127:ERROR:packager_main.cc(554)] Packaging Error: 11 (MUXER_FAILURE): Failed to initialize PesPacketGenerator.

I've tried to find ways to specify the codec(which is h265 by the way) but to no avail. I'm using the latest shaka packager version(2.6.1) which specifies it has support for Dolby Vision in the docs.


Solution

  • The failure is coming from the Shaka Packager 'PesPacketGenerator::Initialize' function.

    It checks if the video codec is h.264 and if it is not it returns false which is triggering the error log you are seeing.

    At this time, Shaka Packager does not support h265 in TS output format - see below the support formats from the Shaka GutHub main page ():

    enter image description here

    If you look at your callback you can see that the error is being generated as Shaka attempts to generate the output stream. The 'MuxerFactory' is looking at the required output format and selecting the 'mp2t::TsMuxer', this in turn initialises the 'TSSegmenter' which calls the 'pes_packet_generator' where the error you are seeing above is generated.

    The reason this is not supported, I believe, is that for h265 the usual recommended HLS format is fmp4 rather than TS. This is discussed in some Shaka issues also: https://github.com/shaka-project/shaka-packager/issues/588

    You can see some examples generating HLS files with fmp4 here: https://shaka-project.github.io/shaka-packager/html/tutorials/dash.html#examples