Since, Apple has announced the 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?
-
you can see the spec here https://tools.ietf.org/html/draft-pantos-http-live-streaming-22 – szatmary May 08 '17 at 20:59
2 Answers
I don't know if it's possible with ffmpeg, but shaka-packager is able to do just this. 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 though, you might have to mux them back into a single mp4 per video stream first):
# 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
Be aware that, at the time of this writing, you need to use the master branch code (or the google/shaka-packager:latest docker image), as the newest release 1.6.2 will just exit with Cannot output both MPD and HLS.
Although I never used it so far, Bento4 is another tool which is able to package DASH and HLS in a single run:
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>

- 641
- 8
- 10
I have also a experimental GPAC/MP4Box branch on github doing this:
https://github.com/DerouineauNicolas/gpac/tree/m3u8_mpd_rext
So far, expected use is the following:
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 master playlist name. Playlists m3u8 files are generated in the same directory than the master playlist.
Feedbacks are welcome.

- 155
- 9