The problem occurred while trying to overlay a stream from mediasoup to another stream (udp, rtmp, etc.).
According to ffmpeg logs, it starts working, processes for a while and stops (line 957 of the log file)
Sending one stream works without issue
I suspect there is something wrong with the stream from mediaasoup
I cannot help with ffmpeg stuff, but most of the “mediasoup + ffmpeg issues” reported in this forum are always related to wrong ffmpeg usage or expectations.
mediasoup (in server side) provides you with tons of debug logs and stats for you to diagnose how good the stream (Consumer) RTP transmission is. Use them.
Also, mediasoup is a SFU rather than a RTP endpoint. It means that the RTP stream that mediasoup forwards to your ffmpeg will be as good (but no more) than the stream that mediasoup receives from the corresponding producer. So if there is packet disorder (generated by the network or due to packet loss) your ffmpeg will receive unordered RTP packets. That’s something you have to “fix” in the receiver side (by setting a RTP jitter buffer, etc). No idea about how to do that in ffmpeg. This is not a forum about ffmpeg. But I know it can be done with GStreamer.
Maybe the overlay filter is encountering a missing PTS from the RTP stream and getting stuck? It looks like there’s some packet loss around line 723.
ffmpeg’s RTP demuxer should deal with out-of-order packets, but if there are dropped packets, you’ll end up with gaps in the PTS timestamps that are emitted from the demuxer. Like ibc said, this isn’t a MediaSoup issue, it’s just a reality of processing RTP. You’ll have to account for these gaps if you’re trying to mix with other streams.
I only work with audio. I need to add aresample=async=1 to any RTP streams before I do any other filtering. This will resample the audio, inserting silent audio frames where there are PTS gaps. You’ll probably need a similar strategy for filling in missing video frames.
Also, the PTS stream coming out of the RTP demuxer should always start at 0. I don’t think the asetpts=PTS-STARTPTS filter is necessary. It’s probably not hurting though.