Docker issue with encoder
Bug/Issue Description: Trying to run dvr-scan inside a docker machine will not be able to find encoder. It can detect the events, it can save the thumbnails but it can't save the video file
Required Information:
dvr-scan -i ./media/originals/mQ3kQ5qjKK-2025-03-30T01-00-04.mp4 -c dvr-scan.cfg --logfile log4.txt --output-dir media/detections/ --thumbnails highscore --verbosity debug
Expected Behavior: The output folder should contain the video file and the thumbnails. Or there's a missing component to install and the documentation doesn't mention it
Computing Environment:
- OS: Docker (Debian) Base image:
mcr.microsoft.com/dotnet/runtime:9.0 - Python Version: 3.11
- OpenCV Version: -
Additional Information: This is the section of the Dockerfile where the installation is done
RUN apt-get install -y python3 python3-pip
RUN python3 -m pip install dvr-scan[opencv-headless] --break-system-packages
Media [Videos/Images/Screenshots]:
logfile content:
INFO: controller.parse_settings(): DVR-Scan 1.6.2
INFO: controller.parse_settings(): Loading config from file: ./dvr-scan.cfg
DEBUG: controller.parse_settings(): Loaded configuration:
{'output-dir': '.\\media\\detected', 'output-mode': 'opencv', 'opencv-codec': 'H264', 'min-event-length': 2.5s, 'time-before-event': 2s, 'time-post-event': 2s, 'threshold': 1.7, 'bounding-box': True, 'bounding-box-smooth-time': 0.1s}
DEBUG: controller.parse_settings(): Program arguments:
Namespace(scan_only=False, thumbnails='highscore', use_pts=False, debug=False, input=['./media/originals/mQ3kQ5qjKK-2025-03-30T01-00-04.mp4'], config='./dvr-scan.cfg', logfile='log4.txt', output_dir='./media/detections/', verbosity='debug')
INFO: controller.run_dvr_scan(): Initializing scan context...
INFO: video_joiner._load_input_videos(): Opened video mQ3kQ5qjKK-2025-03-30T01-00-04.mp4 (1920 x 1080 at 12.000 FPS).
DEBUG: scanner._handle_regions(): No regions selected.
INFO: scanner.scan(): Using subtractor MOG2 with kernel_size = 7 (auto), variance_threshold = auto and learning_rate = auto
INFO: scanner.scan(): Scanning input video for motion events...
DEBUG: scanner.scan(): event 1 high score 15.478805
INFO: __main__.main(): Stopping (interrupt received)...
Traceback (most recent call last):
File "/usr/local/lib/python3.11/dist-packages/dvr_scan/__main__.py", line 41, in main
run_dvr_scan(settings)
File "/usr/local/lib/python3.11/dist-packages/dvr_scan/cli/controller.py", line 311, in run_dvr_scan
result = scanner.scan()
^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/dvr_scan/scanner.py", line 744, in scan
result = detector.update(frame.frame_bgr)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/dvr_scan/detector.py", line 114, in update
subtracted = self._subtractor.apply(frame)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/dvr_scan/subtractor.py", line 73, in apply
frame_mask = self._subtractor.apply(frame_gray, learningRate=self._learning_rate)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyboardInterrupt
You might want to use the ffmpeg or copy outputs mode if you don't need any overlays since it's quicker and provides higher quality. In the meantime I'll see if we can do some better error handling here.
I'm not sure why there are no errors printed from the Python side of things when this happens.
I also wonder if the https://packages.debian.org/sid/python3-opencv package needs to be installed instead, or the base image is missing some needed shared libs.