How do I create an HLS manifest from MPEG DASH segments?

Since Apple announced support for fragmented MP4, is it possible to create both DASH manifest (.mpd) and HLS manifest (.m3u8) for the same set of segments (for separate audio and video). How to do it?

+3


source to share


2 answers


I don't know if this is possible with ffmpeg, but shaka-packager can do just that. The following command will output MP4 segments as well as HLS and DASH manifests, reusing MP4 segments for both (not sure if you can use existing MP4 segments, although you might have to cast them back to one mp4 per video stream):

# HLS + DASH
packager \
    'in=h264_baseline_360p_720.mp4,stream=audio,init_segment=audio_init.mp4,segment_template=audio_$Number$.m4s,playlist_name=audio.m3u8,hls_group_id=audio,hls_name=ENGLISH' \
    'in=h264_baseline_360p_720.mp4,stream=video,init_segment=h264_360p_init.mp4,segment_template=h264_360p_$Number$.m4s,playlist_name=h264_360p.m3u8' \
    'in=h264_main_480p_1400.mp4,stream=video,init_segment=h264_480p_init.mp4,segment_template=h264_480p_$Number$.m4s,playlist_name=h264_480p.m3u8' \
    'in=h264_high_720p_2400.mp4,stream=video,init_segment=h264_720p_init.mp4,segment_template=h264_720p_$Number$.m4s,playlist_name=h264_720p.m3u8' \
    --hls_master_playlist_output h264_master.m3u8 \
    --mpd_output h264.mpd \
    --base_urls https://example.org/ \
    --hls_base_url https://example.org/ \
    --generate_static_mpd

      

Keep in mind that at the time of this writing, you need to use the master branch code (or google / shaka-packager file: latest docker image) as the newest 1.6.2 release will just come out with Can not output both MPD and HLS.



Although I've never used it until now, Bento4 is another tool capable of package DASH and HLS in one pass:

mp4-dash.py  | grep hls
  --hls                 Output HLS playlists in addition to MPEG DASH
  --hls-key-url=<url>   HLS key URL (default: key.bin)
  --hls-master-playlist-name=<filename>
  --hls-media-playlist-name=<filename>
  --hls-iframes-playlist-name=<filename>

      

+2


source


I also have an experimental GPAC / MP4Box branch on github:

https://github.com/DerouineauNicolas/gpac/tree/m3u8_mpd_rext

So far the expected usage has been as follows:



MP4Box -dash 1000 $OUT_DIR/file.mp4#video $OUT_DIR/file.mp4#audio -m3u8-from-mpd $OUT_DIR/hls.m3u8 -segment-name test-$RepresentationID$-$Number%d$ -out $OUT_DIR/file.mpd

      

where -m3u8-from-mpd is the name of the main playlist. Playlists The m3u8 files are created in the same directory as the main playlist.

Feedback is welcome.

+1


source







All Articles