From 6497fa8ccdc3e4904734efc5bef9786417bc451c Mon Sep 17 00:00:00 2001 From: Robert Love Date: Fri, 12 Jun 2026 18:41:57 -0400 Subject: [PATCH] fix(cv): restore FFmpeg-enabled OpenCV so RTSP camera capture works MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- cv/Dockerfile.base | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cv/Dockerfile.base b/cv/Dockerfile.base index 1b1d184..c01cf08 100644 --- a/cv/Dockerfile.base +++ b/cv/Dockerfile.base @@ -62,6 +62,17 @@ RUN --mount=type=cache,target=/root/.cache/pip \ && pip install -r /tmp/req.txt \ && rm /tmp/req.txt +# The nvcr.io base ships its own OpenCV (pip package name `opencv`, built +# WITHOUT FFmpeg) which shadows the opencv-python wheel from req.txt — the +# imported cv2 ends up FFMPEG: NO, so cv2.VideoCapture can't open RTSP and +# every camera open fails instantly. Drop the base build and force-reinstall +# the pip wheel (FFMPEG: YES), then assert the backend is present so this +# regression cannot return silently in a future base bump. +RUN --mount=type=cache,target=/root/.cache/pip \ + pip uninstall -y opencv opencv-python opencv-python-headless || true \ + && pip install --force-reinstall --no-deps "opencv-python>=4.10" \ + && python3 -c "import cv2; bi=cv2.getBuildInformation(); assert any('FFMPEG' in l and l.strip().endswith('YES') for l in bi.splitlines()), 'OpenCV FFMPEG backend missing — RTSP capture would fail'; print('cv2', cv2.__version__, 'FFMPEG: YES')" + # Diagnostic: print the compiled arch list so a future regression is # visible in build logs. With the nvcr.io base on 25.04, expect sm_70 # through sm_120 (Volta through Blackwell). Pascal (sm_61) is not