I am trying to build a Javascript web streammer, which uses MediSource and a buffer.
I append to the buffer every new fragment that is comming, which allows me to stream a video.
To be more in context, its done with MPEG DASH. I have the video init.mp4 file and the m4s fragments.
However, I want to add some videos that are pure mp4 video, and I cannot append them to the buffer, since they are not fragments related to the first stream. I was thinking about converting them to m4s fragment, but I don’t understand how to do it. As far as I’ve read, m4s fragments are mp4 videos without the initial metadata and some other atoms/boxes removed.
Is there a way to convert a mp4 video to one big m4s segment of the same duration and to properly append it to the MediaSource buffer? Is there a way to manually create a m4s segment from a mp4 video?
I tried multiple tools such as Bento4 and some ffmpeg commands that converts the mp4 video in a mp4 fragment. But every time I append it to the buffer, the video stops and cannot read further. Especially with chrome.
With bento4, after I mp4fragment, chrome can’t seem to play the second fragment and the player always stops.
Bogdan Rusu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.