Mediasoup Recording switching video streams dynamically

Hi Everyone,

I able to record the streams of each participant in the video call. But while recording when the user stops the video, the latest user stream got attached throughout the recording.

Is there is any way to replace a static image when video stream is not available and as soon as the video stream is available it should replace the static image.

Example:
When there is no video stream → it should use static image
when there is video stream → it should use respective video stream.

My ffmpeg command for recording

ffmpeg -nostdin -protocol_whitelist file,rtp,udp -fflags +genpts -i input-vp8.sdp -map 0:a:0 -c:a copy -map 0:v:0 -c:v copy -f webm -flags +global_header -y output.webm

input-vp8.sdp file

file v=0
o=- 0 0 IN IP4 127.0.0.1
s=-
c=IN IP4 127.0.0.1
t=0 0
m=audio 5004 RTP/AVPF 111
a=rtcp:5005
a=rtpmap:111 opus/48000/2
a=fmtp:111 minptime=10;useinbandfec=1
m=video 5006 RTP/AVPF 96
a=rtcp:5007
a=rtpmap:96 VP8/90000

I could not find any documentation or links to do this. Kindly guide me on this. Thanks for help in advance.