[FFmpeg-user] Stream without audio and ffmpeg delay

Giuseppe Modugno giuseppe.modugno.loqed at gmail.com
Tue Aug 3 14:41:50 EEST 2021


I'm trying to receive and store a stream from an IPCam by using ffmpeg. 
The stream is transported over RTPS/RTP.

The cam has an option (in its web configuration pages) for 
enabling/disabling audio. When I disable audio, something strange happens.

First of all, RTSP DESCRIBE response from the camera reports *always* 
the presence of an audio stream. I suspect this is why ffmpeg says 
something for video *and audio*, even if audio is disabled.

It seems the audio enabling/disabling option simply blocks the 
transmisson of audio frames/packets at low-level. Wireshark shows audio 
packets interleaved with video packets when audio is enabled. After 
disabling audio, Wiresharl doesn't show audio packets anymore. RTSP 
responses don't change.

Now, when audio is disabled on the CAM (but announced over RTSP 
DESCRIBE), something strange happens with ffmpeg. First of all, there is 
a very big delay since launching ffmpeg and generating the output file. 
I mean around 30-50 seconds!!
Moreover the content of the file written now is related to video 
happened 30-50 seconds ago!! So, if I stop ffmpeg now, the file 
generated lacks the last part of video. In theory, if I want to stop 
video now, I should wait for 30-50 seconds before stopping. But, as you 
can undestand, I don't know how to estimate this delay.

This strange behaviour of ffmpeg disappears when audio is enabled or 
audio is disable but I select only video stream with -map 0:0 option.

Unfortunately I don't know in advance if the audio is present in the 
stream so I'm not able to launch ffmpeg in such a way there isn't so 
long delay.

I was thinking this delay was caused by the audio/video sync mechanism 
inside ffmpeg: it waits for audio frames before outputting video frames 
so they can be written together in sync. However audio frames don't ever 
arrive, so after a long timeout ffmpeg decides to output video frames.

I played with UDP/TCP and probesize too, without great success.

Any suggestions?




More information about the ffmpeg-user mailing list