ffmpeg - Live streaming dash content using mp4box -


i'm trying live stream h.264 content html5 using media source extensions api.

the following method works pretty well:

ffmpeg -i rtsp://10.50.1.29/media/video1 -vcodec copy -f mp4 -reset_timestamps 1 -movflags frag_keyframe+empty_moov -loglevel quiet out.mp4

and then: mp4box -dash 1000 -frag 1000 -frag-rap out.mp4

i can take mp4box output (out_dashinit.mp4) , send through web sockets, chunk chunk, javascript client feeds media source api.

however, not method live content.

what i'm trying now, create single pipeline in order in realtime , minimum possible latency. ffmpeg it's possible redirect output stdout instead of out.mp4 , grab content. couldn't figure out if it's possible combine mp4box pipeline.

  1. can mp4box take input data source not file?
  2. can mp4box grab such content progressively (either file or other source) while arriving in realtime? i.e. wait little if stream stops 1 sec , resume automatically.
  3. same question output: can output not file (such stdout) , can progressively whenever output data ready, able take , transfer web client, generating never-ending dashed mp4.

you don't need mp4box generate required output, you'll need chunk content looking boxes in generated file.

basically you'll generate fmp4 h264, , send browser moov box initialization , moof+mdat boxes each fragment of mp4 generate. you'll have code player in javascript, won't able use standard dash player.

to generate correct fragmented mp4, need pass ffmpeg: -movflags empty_moov+omit_tfhd_offset+frag_keyframe+default_base_moof.

be sure use latest version available.


Comments