4
votes

I have a video stream that I want to broadcast via RTMP.

I'm using ffmpeg to do so, with the following command:

ffmpeg -i http://192.168.1.77:18000/stream.flv -c copy -f flv rtmp://localhost/myapp/mystream

As far as I know, transcoding the video stream would introduce some latency. So my question is: is it possible that I am introducing latency in the output stream by using this ffmpeg command (copy)?


Side note: I'm trying to redirect my live video stream to a nginx-server in order to broadcast it (via RTMP) for several jwplayers. So far I got a delay of 1 second and some frames and I am wondering if it is possible to reduce it.

2
-fflags nobuffer might help... trac.ffmpeg.org/wiki/StreamingGuide#Latency I can't imagine how this is introducing much latency else wise...rogerdpack
Thanks @rogerdpack! I tried -fflags nobuffer and it was ok, but after a while ffmpeg.exe crashed, I'm not sure why. But I managed to solve my problem without changing the ffmpeg command so I guess the latency it is not its fault.André Alves
You can use ffplayer with nobuffer to test the latency, refer to this answerLF00

2 Answers

4
votes

Well, I solved my problem!

I ended up trying with a different player and different settings and managed to get some frames latency (or no latency at all), so I guess this ffmpeg command is not introducing latency at all.

Just for the record, I'm using flowplayer with the following settings:

$f("streams", "http://releases.flowplayer.org/swf/flowplayer-3.2.18.swf", {

                clip: {
                    url: 'mystream',
                    provider: 'rtmp',
                    live: true,
                    bufferLength: 0,
                    bufferTime: 0,
                },

                plugins: {
                     rtmp: {
                        url: 'flowplayer.rtmp-3.2.3.swf',
                        netConnectionUrl: 'rtmp://192.168.1.196:1935/myapp'
                    }
                }
            });
1
votes

Everything will introduce a little latency. Nothing is done for free, and time keeps moving forward. 1 second is really good for rtmp. To reduce latency, you need to reduce steps between ingest and delivery. The best way to do this is use a detected server product such as wowza or FMS.