Ask Your Question

OpenCV does not read Logitech C920 .wmv files

asked 2019-11-05 11:25:59 -0500

auesro gravatar image

System used:

OpenCV = 4.1.1 (through opencv-python)
Operating System / Platform => Windows 10 64 Bit and Linux Mint 19.1

Detailed description:

Properties and frame indexes from videos recorded by the Logitech Webcam C920 are not properly read by OpenCV:

cv2.CAP_PROP_POS_MSEC returns 0.0 for a video that lasts 10.14 minutes.

cv2.CAP_PROP_FOURCC returns code 844516695.

cv2.CAP_PROP_FPS returns 1000 fps for videos that were recorded at 30 fps.

cv2.CAP_PROP_FRAME_COUNT returns 614126 frames. When decoding and counting them one by one gives 18416, a value that agrees with expected number of frames for a video of 10 minutes recorded at 30 fps.

Moreover, indexing frames by frame number results in wrong frame: for example, using this code you can display the frame number 60000, which doesnt exist:

import cv2

stream = cv2.VideoCapture('video.wmv')
frame_number = 60000
stream.set(0, frame_number)
ret, frame =
cv2.imshow('', frame)

So in summary, apparently metadata from wmv videos recorded by Logitech webcam C920 cannot properly read (if it exists) by OpenCV.

Use following code and file to reproduce:

import cv2

stream = cv2.VideoCapture('video.wmv')
fps = stream.get(cv2.CAP_PROP_FPS)
total_frames = int(stream.get(cv2.CAP_PROP_FRAME_COUNT))
duration = stream.get(cv2.CAP_PROP_POS_MSEC)
fourcc = int(stream.get(cv2.CAP_PROP_FOURCC))

count = 0
      ret, frame =
        if not ret:
        count += 1


Any ideas how to solve this?

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2019-11-06 14:00:01 -0500

supra56 gravatar image

updated 2019-11-06 14:04:15 -0500

You wanted to count frame by frame?


import cv2
cap = cv2.VideoCapture('video.wmv')
fps = cap.get(cv2.CAP_PROP_FPS)
frames = cap.get(cv2.CAP_PROP_FRAME_COUNT)

frame_counter = 0

while cap.isOpened():
    ret, frame =
    print(f'number of frames: ' + str(len(frame_by_frame)))
    cv2.imshow('frame', frame)
    if cv2.waitKey(1) == ord('q'):
edit flag offensive delete link more


Thanks for your effort but I know how to count the frames "manually". What I need is to find out why OpenCV will not read those tags from a Logitech C920 webcamera and if there is anything I can do to change it.

auesro gravatar imageauesro ( 2019-11-25 05:41:06 -0500 )edit

answered 2019-11-08 09:01:21 -0500

auesro gravatar image

What I want to know is why OpenCV does not report properly neither FPS nor total number of frames in a video recorded with a Logitech C920 webcam with the properties described above.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2019-11-05 11:25:59 -0500

Seen: 241 times

Last updated: Nov 06 '19