[FFmpeg-user] Using ffmpeg to capture rtsp streams

Martin Wohler Martin.Wohler at live.de
Wed Jun 29 18:06:35 EEST 2022

Hello guys,

I'm not sure if I've registered to the correct mailing list but it is worth a try:
I'm using ffmpeg successfully for many years to capture rtsp streams coming from a tv cable box. But since a couple of month I'm running into more and more trouble. Since many weeks of analysing this problem it turned out that additional audio streams newly provided by the tv channels are causing the problem. Initial calls of ffmpeg are looking like this:
"C:\ServerFolders\Public\Tools\ffmpeg\bin\ffmpeg.exe" -i "rtsp://,16,17,18,20,105,6661,6662,6663,6664,6665,6666,6667,6668,6669" -loglevel quiet -y -c copy -ignore_unknown -map 0 -map -0:d -t 60 "C:\ServerFolders\Public\TV-Aufnahmen\FritzTV-Rec - 1656512640 - Schamanen_in_der_Mongolei.ts"
The mapping options include everything except data streams like epg data which are useless anyway within a tv recording and tended to confuse ffmpeg because of missing timestamps. The problem now seems to be that many tv channels have started to add audio streams which are always there but which often don't receive any data. E.g. the original language version for movies like Icelandic for Icelandic movies or an additional audio stream with a voiceover for blinded people. My problem now is that I need to start a rtsp capture a couple of minutes before the desired tv broadcast, e.g. within the evening news where the ov stream is existent but empty. Ffmpeg now seems to try during start to analyse every available stream for valid data and aborts if there is an empty stream not receiving any data leaving an empty recording file. My first approach was to use ffprobe to analyse the existing streams and to exclude audio streams without data which ffprobe detects as audio streams with a sample rate of 0 and 0 channels. Problem there is that the stream ids seem to be dependant of the time when a call of ffprope or ffmpeg kicks in. So the id of any invalid audio stream detected with a call off ffprobe must not have the same id when ffmpeg is called shortly after. And this is not the desired result anyway because I want to have captured everything. When an audio stream is empty when ffmpeg is called it should not be a cause for error abortions and as soon as there is incoming data it should be added to the target file. My final failsafe call to start the capturing if everything before failed is a ffmpeg call without any mapping option which lets ffmpeg select the single captured audio stream itself. This works always but often results in a recording with an unusable audio stream.
Tldr: I need ffmpeg to capture a rtsp stream with all available incoming audio and video data independent of if a stream is empty during start. I don't need any recoding, just having ffmpeg to copy everything that comes in. Is there any possibility with command line options I haven't found yet to do so? Rechecking with VLC media player which uses ffmpeg as internal beating heart I can see that this displays always all available audio streams when I feed it with my rtsp url lists and just providing no sound when I activate an empty audio stream for a selected tv channel.

Kind regards,


More information about the ffmpeg-user mailing list