Camera ffmpeg problem

Hey guys, Im new to home assistant thing so please bear with me. Im using home assistant on synology docker and Im trying to add my compro IP550 Camera to it for 4 days without success. On lovelace card Im seeing the image but when I`m clicking on it I have a infinite loading circle. Here is my configuration.yaml:
ffmpeg:
ffmpeg_bin: /usr/bin/ffmpeg
stream:
camera: !include camera.yaml
config:
logbook:
mobile_app:
person:
ssdp:
system_health:
zeroconf:
discovery:
frontend:
javascript_version: latest
http:
base_url: http://192.168.2.4:8123

and my camera.yaml:

  • platform: ffmpeg
    input: -rtsp_transport tcp -i rtsp://user:[email protected]:554/medias1
    extra_arguments: -pred 1 -q:v 2
    name: Baby IP Camera

And here is some error log from infinite loading circle:

2019-10-11 23:22:09 ERROR (stream_worker) [homeassistant.components.stream.worker] Error demuxing stream: No dts in packet
2019-10-11 23:22:09 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File “/usr/local/lib/python3.7/site-packages/aiohttp/web_protocol.py”, line 418, in start
resp = await task
File “/usr/local/lib/python3.7/site-packages/aiohttp/web_app.py”, line 458, in _handle
resp = await handler(request)
File “/usr/local/lib/python3.7/site-packages/aiohttp/web_middlewares.py”, line 119, in impl
return await handler(request)
File “/usr/src/homeassistant/homeassistant/components/http/real_ip.py”, line 40, in real_ip_middleware
return await handler(request)
File “/usr/src/homeassistant/homeassistant/components/http/ban.py”, line 73, in ban_middleware
return await handler(request)
File “/usr/src/homeassistant/homeassistant/components/http/auth.py”, line 231, in auth_middleware
return await handler(request)
File “/usr/src/homeassistant/homeassistant/components/http/view.py”, line 128, in handle
result = await result
File “/usr/src/homeassistant/homeassistant/components/stream/core.py”, line 181, in get
return await self.handle(request, stream, sequence)
File “/usr/src/homeassistant/homeassistant/components/stream/hls.py”, line 36, in handle
body=renderer.render(track, utcnow()).encode(“utf-8”), headers=headers
File “/usr/src/homeassistant/homeassistant/components/stream/hls.py”, line 95, in render
+ self.render_playlist(track, start_time)
File “/usr/src/homeassistant/homeassistant/components/stream/hls.py”, line 67, in render_preamble
return ["#EXT-X-VERSION:3", f"#EXT-X-TARGETDURATION:{track.target_duration}"]
File “/usr/src/homeassistant/homeassistant/components/stream/core.py”, line 83, in target_duration
return round(sum(durations) // len(self._segments)) or 1
ZeroDivisionError: integer division or modulo by zero

On vlc is working fine, on android ip camera viewer is working fine, ios etc… but on hass not.
I was gonna try generic camera but from where should I get the still_image_url?
Btw my camera has upnp enabled but hass is not seeing it. Any help setting it right please?

I’m not sure, but

  1. Maybe try removing the stream: component and let ffmpeg play on its own.

  2. See if you can check your camera’s config to see what medias1 stream is encoded as. The demuxing stream, no dts in packet likely means ffmpeg is expecting a different stream type.

  3. From the troubleshooting guide https://www.home-assistant.io/integrations/ffmpeg/#troubleshooting maybe try something like: ffmpeg -i rtsp://user:[email protected]:554/medias1 -an -f null -
    to see what the results are.

Thank for reply. Stream1 is encoded as H.264. I found also my still image url http://192.168.2.35/cgi-bin/view/ss.cgi and also tested this config but no joy…

This was the solution. Thank you.

If you have a way to check your CPU usage, you may want to do just that.
I’m not fully understanding how HA works, but I believe without stream:, ffmpeg is doing the heavy work.

What is strange is that using stream: I can see the image of camera but not a live feed and when using more info I have the errors that I gave them in this thread. I wish that I could use stream: …

As soon as I activate stream: I have this log:

2019-10-12 17:21:38 ERROR (stream_worker) [homeassistant.components.stream.worker] Error demuxing stream: No dts in packet
2019-10-12 17:21:38 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File “/usr/local/lib/python3.7/site-packages/aiohttp/web_protocol.py”, line 418, in start
resp = await task
File “/usr/local/lib/python3.7/site-packages/aiohttp/web_app.py”, line 458, in _handle
resp = await handler(request)
File “/usr/local/lib/python3.7/site-packages/aiohttp/web_middlewares.py”, line 119, in impl
return await handler(request)
File “/usr/src/homeassistant/homeassistant/components/http/real_ip.py”, line 40, in real_ip_middleware
return await handler(request)
File “/usr/src/homeassistant/homeassistant/components/http/ban.py”, line 73, in ban_middleware
return await handler(request)
File “/usr/src/homeassistant/homeassistant/components/http/auth.py”, line 231, in auth_middleware
return await handler(request)
File “/usr/src/homeassistant/homeassistant/components/http/view.py”, line 128, in handle
result = await result
File “/usr/src/homeassistant/homeassistant/components/stream/core.py”, line 181, in get
return await self.handle(request, stream, sequence)
File “/usr/src/homeassistant/homeassistant/components/stream/hls.py”, line 36, in handle
body=renderer.render(track, utcnow()).encode(“utf-8”), headers=headers
File “/usr/src/homeassistant/homeassistant/components/stream/hls.py”, line 95, in render
+ self.render_playlist(track, start_time)
File “/usr/src/homeassistant/homeassistant/components/stream/hls.py”, line 67, in render_preamble
return ["#EXT-X-VERSION:3", f"#EXT-X-TARGETDURATION:{track.target_duration}"]
File “/usr/src/homeassistant/homeassistant/components/stream/core.py”, line 83, in target_duration
return round(sum(durations) // len(self._segments)) or 1
ZeroDivisionError: integer division or modulo by zero