I am try to get frames with cv2 but its not working with python 3.5.
I used the following code,this is working fine with python 2.7 but not with 3.5 :
import cv2
vidcap = cv2.VideoCapture('myvideo.mp4')
success,image = vidcap.read()
success = True
while success:
success,image = vidcap.read()
# print 'Read a new frame: ', success
cv2.imwrite("frame%d.jpg" % count, image) # save frame as JPEG
is there changes in syntax.?? Thanks
答案 0 :(得分:0)
"""使用" sudo apt-get install ffmpeg"安装ffmpeg;然后安装ffmpy" pip3 install ffmpy" """
import ffmpy
ff = ffmpy.FFmpeg(inputs={'path_of_video.mp4':None },outputs={'frame.jpg': '-ss 00:00:02 -t 00:00:2 -s 400x400 -r 1 -f mjpeg'})
ff.run()