I have a cheap IP camera that I’m trying to configure to view in Home Assistant. I can view the RTSP stream fine using VLC with the URL rtsp://username:[email protected]:554
, but trying to use this with the “Generic Camera” integration fails, with this error in the logs:
File "av/container/core.pyx", line 401, in av.container.core.open
File "av/container/core.pyx", line 272, in av.container.core.Container.__cinit__
File "av/container/core.pyx", line 292, in av.container.core.Container.err_check
File "av/error.pyx", line 336, in av.error.err_check
av.error.InvalidDataError: [Errno 1094995529] Invalid data found when processing input: 'rtsp://username:[email protected]:554'
I’ve tried both TCP and UDP, both of which produce the same error.
I think ffmpeg is not handling the stream correctly, when it recieves an empty packet. As if I run ffmpeg on the command line:
ffplay -rtsp_transport tcp -i rtsp://username:[email protected]:554 -v 9 -loglevel 99
I get the same error, which seems to happen immediately after an empty line=''
response:
[rtsp @ 000001bcf497c400] line='Cache-Control: private'
[rtsp @ 000001bcf497c400] ret=1 c=78 [x]
[rtsp @ 000001bcf497c400] ret=1 c=2d [-]
[rtsp @ 000001bcf497c400] ret=1 c=44 [D]
[rtsp @ 000001bcf497c400] ret=1 c=79 [y]
[rtsp @ 000001bcf497c400] ret=1 c=6e [n]
[rtsp @ 000001bcf497c400] ret=1 c=61 [a]
[rtsp @ 000001bcf497c400] ret=1 c=6d [m]
[rtsp @ 000001bcf497c400] ret=1 c=69 [i]
[rtsp @ 000001bcf497c400] ret=1 c=63 [c]
[rtsp @ 000001bcf497c400] ret=1 c=2d [-]
[rtsp @ 000001bcf497c400] ret=1 c=52 [R]
[rtsp @ 000001bcf497c400] ret=1 c=61 [a]
[rtsp @ 000001bcf497c400] ret=1 c=74 [t]
[rtsp @ 000001bcf497c400] ret=1 c=65 [e]q= 0KB sq= 0B f=0/0
[rtsp @ 000001bcf497c400] ret=1 c=3a [:]
[rtsp @ 000001bcf497c400] ret=1 c=20 [ ]
[rtsp @ 000001bcf497c400] ret=1 c=31 [1]
]rtsp @ 000001bcf497c400] ret=1 c=0d [
[rtsp @ 000001bcf497c400] ret=1 c=0a [
]
[rtsp @ 000001bcf497c400] line='x-Dynamic-Rate: 1'
]rtsp @ 000001bcf497c400] ret=1 c=0d [
[rtsp @ 000001bcf497c400] ret=1 c=0a [
]
[rtsp @ 000001bcf497c400] line=''
rtsp://username:[email protected]:554: Invalid data found when processing input
(also tried using UDP, same issue)
I’ve tried searching for similar issues with ffmpeg, and there are a lot of topics about this (from several years ago…) but no solutions or workarounds. They also seem to be triggered by something different (in other posts the response from the camera was missing UDP or TCP in the Transport message, but I don’t think that is the case here as I can see it in earlier logs (haven’t included those here because otherwise logs would be too long).
Is there any way around this issue? Perhaps somehow use VLC (or similar) instead of ffmpeg to handle the streams? (as long as they can be displayed in the dashboard it does not matter).
Any help will be greatly appreciated