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