Hi there, I am seeing some strange issues when using opencv (opencv-python==4.3.0.36) in a docker container. First the base image is python:3-slim I have a very simple python file that does something like this:
import cv2
def main(): .... cap = cv2.VideoCapture(video_src) // for the purpose of checking if cap.isOpened(): print("open") else: print("closed")
so if run my container which calls the script (the call looking like python python_file_name.py -f path_to_video_file
I get the following error:
OpenCV(4.3.0) /tmp/pip-req-build-6amqbhlx/opencv/modules/videoio/src/cap_images.cpp:253: error: (-5:Bad argument) CAP_IMAGES: can't find starting number (in the name of file): /sample_video/hkk_video_demo.avi in function 'icvExtractPattern'
and the cap.isOpened() returns false
I have researched this error and many have resolved it being installing some sort of ffmpeg codec. However this is where (for me at least) it gets strange.
When i docker exec -it imageID /bin/bash into the container and run the same command above it runs fine and the cap.isOpened() returns true.
I have tried restructuring the calling mechanism into a few different ways but nothing seems to work when calling from the Dockerfile. I created a script to be called at [ENTRYPOINT] in the Dockerfile with the shebang set to /bin/bash and thought but that might work, but seeing as I am writing this you can guess not.
If anyone has any ideas i would appreciate some feedback. Thanks in advance, wil