kevinGodell / mp4frag

Parser that works with ffmpeg to read piped data and fragment mp4 into an initialization segment and media segments. It can also get the codec info and generate an fmp4 HLS m3u8 playlist.
https://kevingodell.github.io/mp4frag/
MIT License
69 stars 15 forks source link

FFMPEG segments to fragmented mp4 #1

Closed Er-rchydy closed 6 years ago

Er-rchydy commented 6 years ago

I have a long video, i slice it using FFMPEG :

spawn("ffmpeg", [
    '-i', './myvideo.mp4' , 
     '-c:a', 'libfdk_aac', '-ac', '2', '-ab', '128k', '-c:v', 'libx264', 
     '-x264opts', 'keyint=24:min-keyint=24:no-scenecut', 
    '-f', 'segment', '-segment_time', '10', './video/%01d.mp4'
]); 

what i'm trying to do is to turn those small videos to fragmented mp4 using mp4frag and send them via socketIO so i can play them using media source extension, can i achieve that using mp4frag ?

1N50MN14 commented 6 years ago

@kevinGodell It all worked well now I'm successfully creating, serving and playing a multi bitrate fmp4 master m3u8 playlist!

Given I have all of that in place and I know how to server it on demand, what would be a good starting point to serving it live (in the same multi bitrate format) if I may ask?

kevinGodell commented 6 years ago

I have personally never tried using a multi-bitrate playlist, but that feature is supposed to be supported by the hls.js library. Check out the source of https://kevingodell.github.io/streams/hls_mpegts_vod/ to see how I used hls.js.

I am not 100% sure what you mean by serving it live, but any http server technology should work as long as you make all of the fragments available in a public folder.