axiomatic-systems / Bento4

Full-featured MP4 format, MPEG DASH, HLS, CMAF SDK and tools
http://www.bento4.com
1.96k stars 478 forks source link

A single, shared fMP4 file for HLS and DASH manifests #144

Open steffentchr opened 7 years ago

steffentchr commented 7 years ago

I'm chasing the elusive goal on a single fMP4 file per rendition -- to be delivered either as progressive download, to HLS or to DASH.

Currently, this can be achieved for progressive and dash using mp4dash --no-split --hls ..., but the generated HLS manifest relies on mp4 files split for every track:

$ mp4dash --no-split --profiles=on-demand --hls video.fmp4
Parsing media file 1: video.fmp4
Extracting track 2 from video.fmp4
Extracting track 1 from video.fmp4
Parsing media file 1: tmp5j3pQA = Extracted[track 2 from video.fmp4]
Parsing media file 2: tmpbwwPqS = Extracted[track 1 from video.fmp4]
Processing and Copying media file tmp5j3pQA = Extracted[track 2 from video.fmp4]
Processing and Copying media file tmpbwwPqS = Extracted[track 1 from video.fmp4]
$ ls -al output/
    4096 May 23 00:38 .
    4096 May 23 00:38 ..
     415 May 23 00:38 master.m3u8
     415 May 23 00:38 media-audio-en-mp4a.m3u8
  274149 May 23 00:38 media-audio-en-mp4a.mp4
     408 May 23 00:38 media-video-avc1.m3u8
 1578452 May 23 00:38 media-video-avc1.mp4
    1339 May 23 00:38 stream.mpd

Is this due to an inherent constraint in how fragmented mp4s work with HLS, or are there any plans to support this for HLS as well?

barbibulle commented 7 years ago

In theory there's nothing that should prevent have HLS/fMP4 work with both audio and video fragments located in the same file. But since it is much easier to have one file per track (this way the tool does not have to recombine multiple tracks into a single file) that's the way the tool does it. But I do see the value in being able to use the file as a downloadable asset without having to re-assemble it on the fly when requested. I'll look into whether that would be easy to support in the toolset, and if it is I'll try to implement it.

On Mon, May 22, 2017 at 3:43 PM, Steffen Tiedemann Christensen < notifications@github.com> wrote:

I'm chasing the elusive goal on a single fMP4 file per rendition -- to be delivered either as progressive download, to HLS or to DASH.

Currently, this can be achieved for progressive and dash using mp4dash --no-split --hls ..., but the generated HLS manifest relies on mp4 files split for every track:

$ mp4dash --no-split --profiles=on-demand --hls video.fmp4 Parsing media file 1: video.fmp4 Extracting track 2 from video.fmp4 Extracting track 1 from video.fmp4 Parsing media file 1: tmp5j3pQA = Extracted[track 2 from video.fmp4] Parsing media file 2: tmpbwwPqS = Extracted[track 1 from video.fmp4] Processing and Copying media file tmp5j3pQA = Extracted[track 2 from video.fmp4] Processing and Copying media file tmpbwwPqS = Extracted[track 1 from video.fmp4] $ ls -al output/ 4096 May 23 00:38 . 4096 May 23 00:38 .. 415 May 23 00:38 master.m3u8 415 May 23 00:38 media-audio-en-mp4a.m3u8 274149 May 23 00:38 media-audio-en-mp4a.mp4 408 May 23 00:38 media-video-avc1.m3u8 1578452 May 23 00:38 media-video-avc1.mp4 1339 May 23 00:38 stream.mpd```

Is this due to an inherent constraint in how fragmented mp4s work with HLS, or are there any plans to support this for HLS as well?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/axiomatic-systems/Bento4/issues/144, or mute the thread https://github.com/notifications/unsubscribe-auth/ACWJjf6blDdbmNMOOPzdFEYcEsSZRZvjks5r8g-WgaJpZM4Ni-WI .

steffentchr commented 7 years ago

Sounds exciting -- and it certainly consolidating these two would have a huge impact on CDN cache utilization, since all three playback methods would lean in the exact same bits and bytes.

Let us know if we (@23) can support the effort -- whether in time or anything else.

calvincorreli commented 6 years ago

Haha, hi @steffentchr, merry xmas, glad to meet you here :)

Did you find a solution to this? I've been chasing this exact elusive goal myself this week!

steffentchr commented 6 years ago

Small world -- nope, unfortunately not yet.

calvincorreli commented 6 years ago

Bummer. Do you use the output exactly as it's produced here? I'm not a fan of the file names, but if it works, then, hey ... keep things simple.

Say hi to Señor Marron :)