axiomatic-systems / Bento4

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

Packaging DASH stream with time based index without splitting mp4 file #957

Open jinyeng opened 7 months ago

jinyeng commented 7 months ago

I want to keep the fragmented mp4 file without splitting it and use the SegmentTemplate with time based indexing. I have tried all possible combinations however unable to have it working without splitting the file. Only if I use the --smooth option with --no-split the file is not split in to segment and also it uses the time based template. Checking if there is some option that I am missing ?

Here is the smooth example, however it generates additional ism files and it uses following template
media="stream.ism/QualityLevels($Bandwidth$)/Fragments(video=$Time$)"

Here is command

mp4dash -f --smooth /home/sample/a.2.mp4 /home/sample/v10000.2.mp4 /home/sample/v1000.2.mp4 /home/sample/v600.2.mp4 /home/sample/v300.2.mp4 -o /home/sample/mpd --mpd-name=410776960.mpd --no-split

barbibulle commented 6 months ago

You should get a non-split file with the on-demand profile of DASH. Use the --profile on-demand option with mp4dash. The template isn't really time-based, since in that case the client locates the segments with the segment index that's included in the file, so we can call that index-based rather than time-based. I suppose that still gets you what you want.

jinyeng commented 6 months ago

To clarify the above --no-split with on-demand profile, it generates a Byte range based format, with SegmentBase.

Is that the Index you are referring to ? Or index as in number based format where files are not split, and using a seg-1.m4s, seg-2.m4s ... format ?

Tricky part is my CDN does not support caching for the byterange based format, so I am looking at an option that still uses the Fragmented MP4 but with time or number based url instead of using the byte range header.

barbibulle commented 6 months ago

The index here is a binary index located in the init segment. The player accesses individual segments using byte ranges. I'm not quite sure I understand how you would want to use non-byte-range access without the files being split into individual segment files, unless you have a special server that can virtualize the file, allowing a client to make a request for a discreet URL per segment, and the server resolving that URL to a portion of the file (this is how some media servers operate, like the Smooth Streaming Server from Microsoft). Is that what you have in mind? If so, what server are you using, and what URL scheme does it use to virtualize the file?