[FFmpeg-user] How to stop input sources stalling when one of the sources is a live input?

Jun Hao Xu jun at spalk.co
Wed Mar 8 01:11:44 EET 2023

Sorry, forgot to include an example. Here is a barebone reproducible
example which is hitting the issue I am facing.

ffmpeg -fflags nobuffer -v info -i $SRT_URL -f lavfi -i anullsrc
-filter_complex [0:v:0]null;anull;anull -copyts testout.mp4 -y

On Wed, Mar 8, 2023 at 11:17 AM Jun Hao Xu <jun at spalk.co> wrote:

> Hi there, apologies if I am using the incorrect terminology but I am
> currently facing an issue around my current FFMPEG set up.
> Context is that I am taking in a live SRT input (which could have multiple
> tracks on them) and sending that through to a Janus node which is expecting
> us to send a signal on different ports. I use a tee to split my SRT tracks
> and send them onto the different ports and happy days. Sometimes we might
> not get a multi track SRT input and Janus will complain if I don't send any
> signal on all the ports it needs and so substitute it by using a `anullsrc`
> input and happy days.
> This works fine at the beginning where the PTS starts from 0 for both
> anullsrc and the live input but if for some reason the ffmpeg process dies
> or I need to restart it, we would get the PTS of the `anullsrc` starting at
> 0 but obviously my stream will have progressed pass 0 and what I've
> observed using the ashowinfo component was that the input will stall until
> the PTS time of the anullsrc catches up with the live input. This isn't
> ideal as then I hit an issue with No Room to Store incoming packet in my
> FFMPEG process.
> Is there a way to sync up the anullsrc with the live input in the FFMPEG
> command or some way to prevent this stalling? I know you can use -itsoffset
> but I won't have any idea how far along my live input is ahead of time.

More information about the ffmpeg-user mailing list