简体   繁体   中英

How to convert a video to its image frames without saving them in the file?

This is the code which I wrote to convert video to image.

vidcap = cv2.VideoCapture('tangled.mp4')
success,image = vidcap.read()
count = 0
while success:
cv2.imwrite("frame%d.jpg" % count, image)     # save frame as JPEG file      
success,image = vidcap.read()
print('Read a new frame: ', success)
count += 1  

using this code the video will get converted to image and the images will be saved in the file. Is there any possible way that the image frames wont get saved on the file?

Just remove this line - cv2.imwrite("frame%d.jpg" % count, image)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM