3
votes

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?

2
man that seems like a bug, maybe ping the ffmpeg-user ML?rogerdpack
Hi, I ran this exact same command in Win 8. But I am getting the following error at the end: [flv @ 03990f40] Failed to update header with correct duration. [flv @ 03990f40] Failed to update header with correct filesize. Any idea?kajarigd

2 Answers

0
votes

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.

0
votes

It may be caused by your file or your file length.

When a file ended, ffmpeg will show info like this:

enter image description here

I came to this issue when I push a 11s mp4 videos, when I change to a long mp4 file with 10+ minutes, it works well.

So you can use another mp4 file with proper length.