Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert m3u8 (HLS) to mpd (MPEG-DASH) [closed]

I have Live stream of HLS [https://82-80-192-30.vidnt.com/ipbc_IPBCchannel11LVMRepeat/definst/IPBCchannel11LVM_3.stream/playlist.m3u8] and I want to convert it to MPEG-DASH.

What is the best practice?

The stream is already h264 aac therefore I understand I do not need to reencode and I just need to transmux.

What should I use? ffmpeg? mp4box?

Notes:

  1. I used nginx-rtmp-module (https://github.com/ut0mt8/nginx-rtmp-module/) in order to create DASH from RTMP stream according to this tutorial: https://isrv.pw/html5-live-streaming-with-mpeg-dash But nginx-rtmp-module can get as input just rtmp streams and it did not work for me with HLS stream.

  2. I used ffmpeg in order to create dash from m3u8 as following:

    ffmpeg -i https://82-80-192-30.vidnt.com/ipbc_IPBCchannel11LVMRepeat/_definst_/IPBCchannel11LVM_3.stream/playlist.m3u8 -strict -2 -min_seg_duration 2000 -window_size 5 -extra_window_size 5 -use_template 1 -use_timeline 1 -f dash out.mpd

But this is very limited. I can't control the segment duration. The min_seg_duration parameter of ffmpeg does not work very well for me, and also it can set the minimum duration while I want to limit the maximum duration of each segment (the segment comes out with ~10 seconds, while I need it to be ~2-4 seconds as I'm playing live).

like image 994
Almog Avatar asked Feb 01 '26 00:02

Almog


1 Answers

Firstly it is worth saying that if you can avoid doing this you will be saving yourself a whole lot of work!

Most devices and clients these days can play both HLS and DASH streams, so the usual approach is to add any extra functionality needed in your app or client.

If you do have to convert server side, then its worth being aware that while HLS streams typically used TS segments in the past, recently support for fragmented MP4 has become available within the HLS ecosystem.

If you have TS video streams then you will need to do a conversion along the lines you outline above with ffmpeg.

If you have fragmented MP4 then you should actually have the correct format already and may find you just have to create the manifest file so DASH can access the fragmented mp4 streams.

All the above assumes that your content is not encrypted or that you don't have to support encryption - if it is then you may not be able to convert the media, or you may have to also encrypt the media differently for some streams than others, as currently most deployed windows and chrome devices and browsers use a slightly different encryption approach (a different AES mode) than Apple devices.

like image 119
Mick Avatar answered Feb 03 '26 20:02

Mick



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!