Question

I am using ffmpeg to create an mp4 file on my server. I am also trying to use qt fast start to be able to move the moov atom to the front so it will stream. I have searched all over the internet with no luck. Is it possible to put my video/audio in a mp4 buffer type file and then be able to play it while ffmpeg is still dumping video and audio data into the stream? the point is I am trying to stream from a camera and Android is horrid... I know both ios and android support mp4 so I was trying to figure a way I can make my rtsp Mp4.

main point of the story: I want to continuously feed my mp4 container my camera feed and still be able to playback the file os my clients can watch.

any help appreciated thank you.

Was it helpful?

Solution

You can publish a live stream and when the stream has ended you publish the progressive download.

In FFmpeg, to stream live and save a duplicate of that stream into a file at the same time without encoding twice you can use the Tee pseudo-mixer. Something like this:

ffmpeg \
  -i <input-stream> \
  -f tee "[movflags=+faststart]output.mp4|http://<ffserver>/<feed_name>"

Update: You might try to directly stream a fragmented mp4.

Update 2:

  • Create a fragmented mp4:

    ffmpeg -i input -frag_duration 1000 stream.mp4
    
  • Normally, when serving a file using a web server it will want to know the file size, so to serve the file without knowing it's size, you need to configure your web server to do Chunked Transfer Encoding.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top