How to publish flv file using ffmpeg on RTMP server in real time?

what I'm trying to do is publish the .flv media file to the RTMP server so that subscribers can watch it. I am testing stream viewing with multiple subscribers ( oflaDemo ) and ffplay .

the problem is that ffmpeg publishes 5 minutes of the .flv file to the server in almost 20 seconds, in these 20 seconds the stream appears on the subscriptions, but after that it cuts. command i use:

 ffmpeg -i file.flv -re -acodec copy -vcodec copy -f flv "rtmp://localhost/oflaDemo/aaa live=1" 

how can I get ffmpeg to transfer a 5 minute file stream in 5 minutes or any other solution.

thanks.

+7
source share
1 answer

i decided he

-re should be the first parameter:

 ffmpeg -re -i file.flv -acodec copy -vcodec copy -f flv rtmp://localhost/oflaDemo/a3 

from ffmpeg official documentation

General syntax:

 ffmpeg [global options] [[infile options]['-i' infile]]... {[outfile options] outfile}... 

-re (input)

Read input at your own frame rate. It is mainly used to simulate a capture device. By default, ffmpeg tries to read the input as fast as possible. This option slows down the reading of input (s) to the native frame rate of input (s) .....

the docs indicate that the -re parameter is an input flag, which means that it should be in infile options immediately before the -i flag

+11
source

All Articles