N
N
Nikita Kargin2021-11-19 15:32:18
Python
Nikita Kargin, 2021-11-19 15:32:18

Why is the video collected in the python exe file not saved when recording via opencv?

Created a program for collecting dataset. In it, a person must perform certain actions, and this is recorded on video. I record the video like this:

fourcc = cv2.VideoWriter_fourcc(*'XVID')
#width и height - это соответственно ширина и высота кадра
recorder=cv2.VideoWriter("cam0.avi", fourcc, 25, (width,height))
cam=cv2.VideoCapture(0)
success,frame=cam.read()
recorder.write(frame)
cap.release()
recorder.release()

In the code, of course, everything is more complicated, but you get the point. This whole system works great when run through a py file or from a Jupyter Notebook. However, to distribute this program, I compiled it into an exe file using pyinstaller. The program works as it should, but the recorded videos are empty (take up 0 bytes and are not played). What is the problem?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question