[FFmpeg-devel] [PATCH] avformat/tee: signal EOF if no more output is to be published.

Gyan Doshi ffmpeg at gyani.pro
Fri Feb 3 06:22:36 EET 2023

On 2023-02-03 04:17 am, Marton Balint wrote:
> On Thu, 2 Feb 2023, Gyan Doshi wrote:
>> Prior to 2d924b3a630, ffmpeg.c would exit if any packet write failed. 
>> tee's
>> write_packet seemingly relied on that to enforce its abort failure 
>> policy.
>>> From 2d924b3a630, ffmpeg only closes that OutputStream and keeps on
>> sending packets of other streams.
> Hmm, are you sure? I glanced at the code and it seems to me that any 
> failure of av_interleaved_write_frame() will cause the muxing thread 
> to exit. So I don't quite see how other streams can receive packets.

Steps to reproduce:

1) ffmpeg -readrate 1 -stream_loop -1 -i INPUT -map 0:v -map 0:a -c copy 
-f tee "[f=flv:onfail=abort]rtmp://url/playpath|[f=null:onfail=ignore]stub"

2) Kill the rtmp endpoint at the server side. The tee muxer logs that 
it's aborting, however, ffmpeg keeps running. Contrast with 5.1 or 
earlier, which exit.

av_iwf returns EOF which just results in a call to tq_receive_finish() 
for that ost without breaking muxer_thread's loop.


More information about the ffmpeg-devel mailing list