question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

OpenCV2 videoCaputure doesn't work before 4.6

See original GitHub issue

Nuitka version installed with pip:

1.1.8
Commercial: None
Python: 3.8.10 (tags/v3.8.10:3d8993a, May  3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)]
Flavor: Unknown
Executable: C:\Users\dan\AppData\Local\Programs\Python\Python38\python.exe
OS: Windows
Arch: x86_64
WindowsRelease: 10

opencv-python==4.5.5.64

breaking line: if not cap.isOpened(): Simple example:

import numpy as np
import cv2 as cv


cap = cv.VideoCapture('demo.mp4)
if not cap.isOpened():
    print("Cannot open camera")
    exit()
while True:
    # Capture frame-by-frame
    ret, frame = cap.read()
    # if frame is read correctly ret is True
    if not ret:
        print("Can't receive frame (stream end?). Exiting ...")
        break

build command: python -m nuitka --standalone --enable-plugin=numpy --include-data-files=demo.mp4=demo.mp4 entry.py

Error:

Traceback (most recent call last):
  File "C:\Users\dan\Desktop\label\democv\ENTRY~1.DIS\entry.py", line 6, in <module>
TypeError: Incorrect type of self (must be 'VideoCapture' or its derivative)

I get no issues running the python file or using cv2 to read an image, but videoCapure always gives that type error, is there a problem with the capture backend/ffmpeg?

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
kayhayencommented, Nov 22, 2022

Part of the 1.2 release that was made a while ago.

0reactions
kayhayencommented, Nov 7, 2022

This is now on the develop branch, part of the current pre-release and should be part of the immanent 1.2 release.

Read more comments on GitHub >

github_iconTop Results From Across the Web

OpenCV videowrite doesn't write video - Stack Overflow
I use cv2.VideoWriter on linux quite often and it always works. So if the above doesn't work you can always try it on...
Read more >
cv::VideoCapture Class Reference - OpenCV
The class provides C++ API for capturing video from cameras or for reading video files and image sequences. Here is how the class...
Read more >
Loading Video Source OpenCV Python Tutorial
First, we import numpy and cv2, nothing fancy there. Next, we cay cap = cv2.VideoCapture(0) . This will return video from the first...
Read more >
OpenCV error - Jetson Nano - NVIDIA Developer Forums
Seems the videoCapture used the wrong backend (CV_IMAGES). You would try to specify gstreamer backend with: cam= cv2.VideoCapture(camSet, cv2.
Read more >
Faster video file FPS with cv2.VideoCapture and OpenCV
Have you ever worked with a video file via OpenCV's cv2. ... But before we can appreciate the faster, threaded method to video...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found