Skip to content

cv::VideoWriter::open VIDEOIO(CV_IMAGES): raised OpenCV exception: #284

@milansoliya4210

Description

@milansoliya4210

Expected behavior

I am using Opencv Python version 4.1.2.30 for write image to video as mention in code but unfortunately when I run Script in Pycharm it run correctly but when I convert script to EXE from pyinstaller with PYQT5 its give me error like as below.
'

Actual behavior

[ERROR:0] global C:\projects\opencv-python\opencv\modules\videoio\src\cap.cpp (392) cv::VideoWriter::open VIDEOIO(CV_IMAGES): raised OpenCV exception:

OpenCV(4.1.2) C:\projects\opencv-python\opencv\modules\videoio\src\cap_images.cpp:253: error: (-5:Bad argument) CAP_IMAGES: can't find starting number (in the name of file): Detected_video.avi in function 'cv::icvExtractPattern

Steps to reproduce

  • example code
    pathIn = IMG_OUTPUT_FOLDER image_interval = 1 # Interval between two images fps = 1 / image_interval files = video_df frame_array = [] for i in range(len(files.index)): img_name = files.loc[i, 'Image_Name'] filename = os.path.join(pathIn, img_name) # reading each files img = cv2.imread(filename) height, width, layers = img.shape size = (width, height) # inserting the frames into an image array frame_array.append(img) os.chdir(VIDEO_OUTPUT_FOLDER) out = cv2.VideoWriter("Detected_video.avi", cv2.VideoWriter_fourcc(*'DIVX'), fps, size) for i in range(len(frame_array)): # writing to a image array out.write(frame_array[i]) out.release() os.chdir(CWD_PATH)
  • operating system
    windows 10
  • architecture (e.g. x64)
  • opencv-python version 4.1.2.30

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions