how to publish flv file using ffmpeg to RTMP server in `real time`?
Asked Answered
D

1

8

what i'm trying to do is publishing a .flv media file to RTMP server to let subscribers watch it. i'm testing to view the stream in several subscribers (the oflaDemo) and with ffplay.

the problem is that ffmpeg publish the 5 minutes .flv file to the server in nearly 20 seconds, in these 20 seconds the stream appear on subscribes, but after that it cuts. the command i use is:

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

how can i force ffmpeg to stream the 5 minutes file in 5 minutes, or any other solution.

thanks.

Director answered 20/10, 2012 at 15:57 Comment(1)
I believe -re should be used as an input option, but I could be wrong.Someplace
D
19

i solved it

the -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

The generic syntax is:

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

-re (input)

Read input at native frame rate. Mainly used to simulate a grab device. By default ffmpeg attempts to read the input(s) as fast as possible. This option will slow down the reading of the input(s) to the native frame rate of the input(s).....

the docs says that -re option is input flag which means that it should be in infile options directly before the -i flag

Director answered 20/10, 2012 at 18:26 Comment(1)
I am trying the same thing: Red5 as server, and ffmpeg feeds the stream, and use ffplay or VLC to view the stream. Now I cannot view the stream! How do you do that? Thanks!Ackerley

© 2022 - 2024 — McMap. All rights reserved.