My code run very well. But this process is tiring my processor. I have 1000+ videos to make it
Is there anyone to have more useful code?
import cv2
video = cv2.VideoCapture("E:/videos/example1.mp4")
length = int(video.get(cv2.CAP_PROP_FRAME_COUNT))
video.get(cv2.CAP_INTELPERC_IMAGE_GENERATOR)
print( length )
i=0
while True:
ret, frame = video.read()
if not ret:
break
i+=1
if length/50 < i:
cv2.imwrite('res'+str(i)+'.jpg',frame)
break
video.release()
I found new code
import cv2
#taking the input
video_capture = cv2.VideoCapture('E:/videos/examples1.mp4')
#setting the time
video_capture.set(cv2.CAP_PROP_POS_MSEC,137000)
success,image = video_capture.read()
if success:
cv2.imwrite("frame137sec.jpg", image)
video_capture.release()