Ring playback speed x2/4

Hi All :slight_smile:

Just wanted to see if anyone else had experienced this/had a workaround. I’m running the home assistant pre-built VM image (qcow2) in proxmox, versions below:

Home Assistant 2022.9.1 Supervisor 2022.08.6 Operating System 8.5 Frontend 20220907.0 - latest

I’ve got the official Ring integration (not via HACS) and while all sensors etc seem to be working and the playback of the last recorded clip, I find that it play in 2/3x speed, so the clips over in a couple of seconds and not easy to view.

I have found the below error in my log which happens everytime trying to view the clips, I’ve cleared each time and confirmed. Wondered if anyone had a way to play this at normal speed or wether it’s likely to be a bug?

Logger: aiohttp.server
Source: components/ring/camera.py:145
First occurred: 11:22:24 (4 occurrences)
Last logged: 11:23:54

Error handling request
Traceback (most recent call last):
File “/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py”, line 435, in _handle_request
resp = await request_handler(request)
File “/usr/local/lib/python3.10/site-packages/aiohttp/web_app.py”, line 504, in _handle
resp = await handler(request)
File “/usr/local/lib/python3.10/site-packages/aiohttp/web_middlewares.py”, line 117, in impl
return await handler(request)
File “/usr/src/homeassistant/homeassistant/components/http/security_filter.py”, line 60, in security_filter_middleware
return await handler(request)
File “/usr/src/homeassistant/homeassistant/components/http/forwarded.py”, line 222, in forwarded_middleware
return await handler(request)
File “/usr/src/homeassistant/homeassistant/components/http/request_context.py”, line 28, in request_context_middleware
return await handler(request)
File “/usr/src/homeassistant/homeassistant/components/http/ban.py”, line 82, in ban_middleware
return await handler(request)
File “/usr/src/homeassistant/homeassistant/components/http/auth.py”, line 236, in auth_middleware
return await handler(request)
File “/usr/src/homeassistant/homeassistant/components/http/view.py”, line 136, in handle
result = await result
File “/usr/src/homeassistant/homeassistant/components/camera/init.py”, line 729, in get
return await self.handle(request, camera)
File “/usr/src/homeassistant/homeassistant/components/camera/init.py”, line 769, in handle
stream = await camera.handle_async_mjpeg_stream(request)
File “/usr/src/homeassistant/homeassistant/components/ring/camera.py”, line 145, in handle_async_mjpeg_stream
await stream.close()
File “/usr/local/lib/python3.10/site-packages/haffmpeg/core.py”, line 158, in close
await self._loop.run_in_executor(None, _close)
File “/usr/local/lib/python3.10/concurrent/futures/thread.py”, line 58, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/local/lib/python3.10/site-packages/haffmpeg/core.py”, line 153, in _close
self._proc.stdin.write(b"q")
BrokenPipeError: [Errno 32] Broken pipe

Thanks!

Can’t confirm cause and or a fix but can confirm its exactly the same for me, plays back so fast its not usable, just never looked in to why to be honest.

Ah thanks rossk, at least I can be fairly certain it’s not just my enviroment at least :slight_smile:

Has anybody else had similar issues?
I find this unique as I have two Ring devices integrated (Doorbell & Spotlight Cam)

Doorbell - Playback works fine, at normal speed
Spotlight Cam - Playback at x2 and I get the above error log

The part that is strange, when you check the video_url - the video plays at normal speed


So if I use the Downloader and play the video back locally, it should work fine?

Just curious if anyone has raised this on GitHub yet?

Wondering if someone can steer me in the right direction for raising a bug for this?

As above, I have two devices using the Ring Integration.

  • Doorbell - Playback works fine, at normal speed
  • Spotlight Cam - Playback at x2 and I get the above error log

Version: Home Assistant Core 2022.6.6

Logger: aiohttp.server
Source: components/ring/camera.py:147
First occurred: 15:34:28 (1 occurrences)
Last logged: 15:34:28

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request
    resp = await request_handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 79, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 220, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 137, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 741, in get
    return await self.handle(request, camera)
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 781, in handle
    stream = await camera.handle_async_mjpeg_stream(request)
  File "/usr/src/homeassistant/homeassistant/components/ring/camera.py", line 147, in handle_async_mjpeg_stream
    await stream.close()
  File "/usr/local/lib/python3.9/site-packages/haffmpeg/core.py", line 158, in close
    await self._loop.run_in_executor(None, _close)
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.9/site-packages/haffmpeg/core.py", line 153, in _close
    self._proc.stdin.write(b"q")
BrokenPipeError: [Errno 32] Broken pipe

EDIT: Ring playback speed x2/4 · Issue #86025 · home-assistant/core · GitHub

Unsure about the playback speed, but regarding the “broken pipe” error showing up in the logs if others come here looking for it, I’ve done some research.

My conclusion is that it’s basically harmless, although annoying.

Basically the pattern they’re using is mostly designed for a constant video stream where the client (browser, user) ends the connection before the stream does.

The Ring integration only sends back the most recent clip, however. So it’s a short 10 or 20 seconds or whatever. The ffmpeg process therefore ends before the client closes the video.

Because the “close” attempt always happens after that block ends, whomever closes it, it’s just trying to close an already closed process. Writing to a process that doesn’t exist is a broken pipe, thus the error.

I’ve commented on the github issue, and may submit a fix at some point. But nothing to worry about.