Description
In setups where Home Assistant runs in an IPv6-only container that reaches IoT devices via NAT64, camera still image
snapshots hang indefinitely and produce a cascade of errors every ~10 seconds:
WARNING [haffmpeg.tools] Timeout reading image.
WARNING [haffmpeg.core] Timeout while waiting of FFmpeg
ERROR [homeassistant] Error doing job: Task exception was never retrieved
RuntimeError: read() called while another coroutine is already waiting for incoming data
Root cause: ffmpeg defaults to UDP for RTP media transport. RTSP signaling over TCP (port 554) succeeds, but the camera then sends RTP packets back to the client's IPv4 address from the SETUP exchange. An IPv6-only host has no IPv4 address, so media packets never arrive and ffmpeg blocks forever waiting for frames. The RuntimeError is a downstream symptom of the asyncio stream being stuck.
Fix: Force TCP transport so both signaling and media travel over the same connection. In camera.py, the input_source passed to haffmpeg needs to be prefixed with -rtsp_transport tcp -i (haffmpeg's _put_input accepts multi-word strings and skips adding its own -i):
# async_camera_image
ffmpeg.get_image(
f"-rtsp_transport tcp -i {streaming_url}",
...
)
# handle_async_mjpeg_stream
stream.open_camera(
f"-rtsp_transport tcp -i {streaming_url}",
...
)
This could also be exposed as a config option (alongside the existing extra_arguments field) for users who need it, since -rtsp_transport tcp can slightly increase latency on normal dual-stack setups.
Environment: Home Assistant in Incus container, IPv6-only networking with NAT64 for IoT reach, Tapo camera on the IPv4 IoT segment.
Reproduction Steps
open HA in ipv6 only
Expected behavior
open HA and see preview
If applicable, add error logs.
No response
Device Firmware
n/a
Integration Version
7.1.13
Last known working integration version
none
Using stream component
Yes
Does camera work via official integrations?
Yes
HASS Environment
incus
Search for similar issues
Yes
Additional information
No response
Debug Logs (Required)
..
Description
In setups where Home Assistant runs in an IPv6-only container that reaches IoT devices via NAT64, camera still image
snapshots hang indefinitely and produce a cascade of errors every ~10 seconds:
WARNING [haffmpeg.tools] Timeout reading image.
WARNING [haffmpeg.core] Timeout while waiting of FFmpeg
ERROR [homeassistant] Error doing job: Task exception was never retrieved
RuntimeError: read() called while another coroutine is already waiting for incoming data
Root cause: ffmpeg defaults to UDP for RTP media transport. RTSP signaling over TCP (port 554) succeeds, but the camera then sends RTP packets back to the client's IPv4 address from the SETUP exchange. An IPv6-only host has no IPv4 address, so media packets never arrive and ffmpeg blocks forever waiting for frames. The RuntimeError is a downstream symptom of the asyncio stream being stuck.
Fix: Force TCP transport so both signaling and media travel over the same connection. In camera.py, the input_source passed to haffmpeg needs to be prefixed with -rtsp_transport tcp -i (haffmpeg's _put_input accepts multi-word strings and skips adding its own -i):
This could also be exposed as a config option (alongside the existing extra_arguments field) for users who need it, since -rtsp_transport tcp can slightly increase latency on normal dual-stack setups.
Environment: Home Assistant in Incus container, IPv6-only networking with NAT64 for IoT reach, Tapo camera on the IPv4 IoT segment.
Reproduction Steps
open HA in ipv6 only
Expected behavior
open HA and see preview
If applicable, add error logs.
No response
Device Firmware
n/a
Integration Version
7.1.13
Last known working integration version
none
Using stream component
Yes
Does camera work via official integrations?
Yes
HASS Environment
incus
Search for similar issues
Yes
Additional information
No response
Debug Logs (Required)
..