Skip to content

fix(cv): restore FFmpeg-enabled OpenCV so RTSP camera capture works#41

Merged
rwlove merged 1 commit into
mainfrom
fix/cv-opencv-ffmpeg-backend
Jun 12, 2026
Merged

fix(cv): restore FFmpeg-enabled OpenCV so RTSP camera capture works#41
rwlove merged 1 commit into
mainfrom
fix/cv-opencv-ffmpeg-backend

Conversation

@rwlove

@rwlove rwlove commented Jun 12, 2026

Copy link
Copy Markdown
Owner

Root cause

pump-cv never connected to the gym cameras — every cv2.VideoCapture failed in sub-millisecond time (before any network I/O) with cannot open source. The image's OpenCV has no RTSP backend:

$ kubectl exec ... -- python -c "import cv2; print(cv2.getBuildInformation())"
FFMPEG:   NO
avcodec:  NO
GStreamer: NO

The nvcr.io/nvidia/pytorch:25.04-py3 base ships its own OpenCV (pip package opencv 4.10.0, built without FFmpeg) that shadows the opencv-python wheel from our deps. import cv2 loads the headless 4.10.0, so RTSP can't be opened at all.

Everything else was fine (verified in-pod and from a LAN host):

  • TCP :554 to both cameras open from inside the pod (1–3ms)
  • ffprobe from a LAN host streams h264 640x360 + aac with the configured creds
  • a temp install of opencv-python reports FFMPEG: YES

Fix

In cv/Dockerfile.base, after installing deps: uninstall the base's opencv and force-reinstall the opencv-python wheel (FFmpeg-enabled), then assert the FFmpeg backend is present at build time so a future base bump can't silently regress.

Deploy

This changes cv/Dockerfile.base, so merging triggers cv-base-publish.yml to rebuild the base image. After that, a pump-cv-v0.5.1 tag builds the runtime image, then bump the digest in home-ops.

🤖 Generated with Claude Code

pump-cv could not open any RTSP camera — every cv2.VideoCapture failed
instantly (sub-millisecond, before touching the network) with "cannot open
source". Root cause: the nvcr.io/nvidia/pytorch base ships its own OpenCV
(pip package `opencv` 4.10, built FFMPEG: NO) which shadows the
opencv-python wheel from pyproject deps; the imported cv2 had no FFmpeg or
GStreamer backend, so it cannot speak RTSP at all.

Confirmed in-pod: cv2.getBuildInformation() showed FFMPEG: NO / avcodec: NO,
while TCP :554 to both cameras was open (1-3ms) — i.e. network, creds, and
routing were all fine; only the codec backend was missing. A temp install of
the opencv-python wheel reported FFMPEG: YES.

Fix: after the dependency install, uninstall the base's OpenCV and
force-reinstall the opencv-python wheel (FFMPEG: YES), then assert the FFmpeg
backend is present at build time so a future base bump can't silently
reintroduce the regression.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@rwlove rwlove merged commit 2b923a0 into main Jun 12, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant