[FFmpeg-devel] [PATCH 0/3] Patch set to delay output live stream

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Thu Apr 30 08:45:28 EEST 2020


Tao Zhang:
> Marton Balint <cus at passwd.hu> 于2020年4月30日周四 上午4:55写道:
>>
>>
>>
>> On Thu, 30 Apr 2020, Tao Zhang wrote:
>>
>>> Marton Balint <cus at passwd.hu> 于2020年4月30日周四 上午12:03写道:
>>>>
>>>>
>>>>
>>>> On Wed, 29 Apr 2020, leozhang wrote:
>>>>
>>>>> In some applications, it is required to add delay to live streaming.
>>>>
>>>> In what applications? And if you do this, why not run
>>>>
>>>> sleep 20; ffmpeg ....
>>> In live streaming applications, someone wouldn't want broadcast what's
>>> comming next immediately.
>>> Sleep 20 then ffmpeg is not ok, because the stream is still
>>> broadcasting immediately, and lost 20 seconds signal.
>>
>> So you want to buffer 20 seconds of input, and then start the output?
> yes
>>
>>>>
>>>> I don't see how this is useful at all.
>>>>
>>>> And what is -paced? What it is used for? Isn't it the same as using ffmpeg
>>>> -re? You really should better explain your use case.
>>> -re read the input, -paced write the output.
>>
>> But why do you want to delay every output packet?
> By default, ffmpeg will output packets as fast as possible.
> So I delay output every packet at native frame rate to simulate live stream.

What would be the benefit of your patch for API users (i.e. users that
directly use libavformat and not ffmpeg.c)? Right now your problem seems
to be in ffmpeg.c and not in libavformat.
>>
>>>>
>>>> Regards,
>>>> Marton
>>>>
>>>>> For example, you can add 20 seconds to rtmp stream with below command:
>>>>> ffmpeg -i your_input_stream_address -c copy -map 0:a -map 0:v -f fifo -paced 1 -queue_size 6000000
>>>>> -output_delay 20000000 -fifo_format flv rtmp://example.com/live/delayed_stream_name
>>>>>
>>>>> leozhang (3):
>>>>>  avformat/fifo: add option to delay output
>>>>>  avformat/fifo: add option to write packets in paced way
>>>>>  doc/muxers: add command example how to delay output live stream
>>>>>
>>>>> doc/muxers.texi    | 17 +++++++++++++++++
>>>>> libavformat/fifo.c | 26 ++++++++++++++++++++++++++
>>>>> 2 files changed, 43 insertions(+)
>>>>>
>>>>> --
>>>>> 1.8.3.1
>>>>>



More information about the ffmpeg-devel mailing list