3

So I'm currently trying to write a program that takes X number of frames from a video file and then uses OpenCV to process them. The issue (or possibly a bug) that I'm having is that when using videoCapture.set(cv2.CAP_PROP_POS_FRAMES, ithframe) I get the output [NULL @ 0152ce80] non-existing PPS 0 referenced appear 18 times despite the fact that the program seems to be working.

Here's roughly what I've tried (cap is the cv2.VideoCapture) :

numFrames = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))  #This was returning as a float for some reason
divisor = int(numFrames/10)

cap.set(cv2.CAP_PROP_POS_FRAMES, 1);
success, frame = cap.read()

for i in range(0, numFrames):
  if ((i % divisor) == 0) and (i != 0):
    cap.set(cv2.CAP_PROP_POS_FRAMES, i-1)
    success, frame = cap.read()

    # Do stuff with frame

cap.release()

Now here is what the output for a single loop iteration (where the if statement is true) looks like: Output

It seems like I'm getting the output that I want; I'm getting reasonable values from my image processing functions, and using cv2.imshow() I can see that I'm getting distinctly different frames so I don't know what is causing these null reference messages.

K Rock
  • 31
  • 4

0 Answers0