[FFmpeg-user] How to make ffmpeg keep silence in generated audio files when RTP input is paused

Iñaki Baz Castillo ibc at aliax.net
Tue Sep 19 19:00:11 EEST 2017


I run ffmpeg as follows in order to capture an audio RTP input stream:

  ffmpeg -protocol_whitelist file,udp,rtp -acodec opus -i sdp output.wav

It works. However, if the RTP stream is paused for some seconds (so no
RTP packets are received during that period) and is later resumed, the
generated output.wav files does not contain such a pause/silence.
Instead, no paused period exists at all in the output.wav file.

The RTP packets have a proper timestamp RTP header field. I mean, the
first RTP packet after the paused period has a timestamp value MUCH
higher than the latest packet before the paused period. This makes me
think that ffmpeg just ignores the RTP timestamp header and, instead,
assumes that continuous RTP is received.

I do know that this would work if I generate "silence" RTP packets
(with just padding, for example), but I want to avoid such a hack. I
hope there is a way to tell ffmpeg "hey, don't stop filling the WAV
file (with silence) in periods where no RTP packets are received".

Any help, please?

Thanks a lot.

Iñaki Baz Castillo
<ibc at aliax.net>

More information about the ffmpeg-user mailing list