Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about mp4 fragmentation #3

Open
giannoudak opened this issue Feb 17, 2016 · 10 comments
Open

Question about mp4 fragmentation #3

giannoudak opened this issue Feb 17, 2016 · 10 comments

Comments

@giannoudak
Copy link

Hello Nick!
My name is John Giannoudakis, and i am a software engineer from Greece.
I recently noticed the MediaSource API and thought that this would help me to manually buffer an mp4 video for a mobile ad format i am developing.

I read your article here https://hacks.mozilla.org/2015/07/streaming-media-on-demand-with-media-source-extensions/ and found it very intersting and well writen. Really Good job! Bravo :)

However i can't figure out how to covert my simple mp4 to a fragmented one to play with MSE. I don't want to do DASH so i don't want the MPD manifest file. i use ffmpeg to fragment the mp4 using

ffmpeg -i non_fragmented.mp4 -movflags frag_keyframe+empty_moov fragmented.mp4

but the mp4 file has no duration and when i used it with the code you have in your bunny demo it doesn't work.

Can you please me help me about the process i have to do to create a proper mp4 file for MSE?

Thanks in advance for your time and help
John

@kennylerma
Copy link

I am also struggling with this. The frag_bunny.mp4 works great in IE and Chrome. However, despite my best efforts, I can't reproduce your file even after examining with mp4info and several attempts using a combination of mp4box and ffmpeg. I can can only generate files that will play in one or the other. Please share your encode settings.

Thanks,
Kenny

@cadesalaberry
Copy link

Have you tried faststart ?

ffmpeg -i input.mp4 -movflags faststart -acodec copy -vcodec copy output.mp4

@kennylerma
Copy link

When fragmenting an MP4 for playback with MediaSource, faststart is negated when using frag_keyframe. The frag_bunny.mp4 is a fragmented video with a mp42 container. Currently, I'm making separate videos and using MP4 for IE and WebM for Chrome, but would love to use a single MP4 for both.

@oscxc
Copy link

oscxc commented Aug 30, 2017

How to convert a video to standard 'codecs="avc1.42E01E, mp4a.40.2' like frag_bunny.mp4.
I have used a lot of different ways,all failed.
Now,only your frag_bunny.mp4 works well.

@jitender1991
Copy link

@giannoudak Have you found the solution to your problem? if yes,
Please share the solution, I am also facing same problem.

@IShinji
Copy link

IShinji commented Feb 9, 2018

@giannoudak @jitender1991
Hi, I found a soft to slove this problem. Click here https://www.bento4.com/downloads/, download the soft.
Then use ./bin/mp4fragment non_fragmented.mp4 fragmented.mp4

@IShinji
Copy link

IShinji commented Feb 9, 2018

@oscxc 看我上面的回答,不一样非要一样的codecs,转完之后,查一下codecs,设置上就可以了。

@arjunkesava
Copy link

Front End:
https://github.com/bitmovin/mse-demo/blob/master/index.html
Back End Idea:
https://bitmovin.com/mp4box-dash-content-generation-x264/

I think, these links will help you.

@YiguiDing
Copy link

I've encountered the same problem before

Until I saw this article

https://developer.mozilla.org/en-US/docs/Web/API/Media_Source_Extensions_API/Transcoding_assets_for_MSE#fragmenting

When googling how to convert mp4 to fmp4 using ffmpeg you usually see answers like this

ffmpeg -i non_fragmented.mp4 -movflags frag_keyframe+empty_moov fragmented.mp4

But this command doesn't work for me.

Chrome requires an extra movie flag that is :

-movflags frag_keyframe+empty_moov+default_base_moof

@YiguiDing
Copy link

Test if your file is a Fragmented MP4

https://nickdesaulniers.github.io/mp4info/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants