FFMPEG Streaming using RTMP

desto picture desto · Jul 30, 2013 · Viewed 7.6k times · Source

I'm trying to create a stream using ffmpeg to send a video to a Red5 Server. I've already managed to do this using this command:

ffmpeg -re -y -i "Videos\Video1.mp4" -c:v libx264 -b:v 600k -r 25 -s 640x360 -t 40 -vf yadif -b:a 64k -ac 1 -ar 44100 -f flv "rtmp://192.168.0.12/live/videostream"

My problem is, when ffmpeg finishes encoding the video, it stops the stream, and thus cuts the video short for 5-10 seconds (for short videos), but this gets worse on larger videos.

Is there a way to stop this behavior? I was trying to add a blank 10 second video before and after the original video, but due to some encoding options, I always end up losing audio. And this only kind-of works on the short videos, but on longer videos the problem is still there.

Any recommendations?

Answer

Paul Gregoire picture Paul Gregoire · Feb 20, 2014

I don't believe its possible to tell FFMpeg to keep the connection open after reading the end of the source file. You would most likely have to use Xuggler or some custom modification of FFMpeg to accomplish such a thing.