I am currently working on a project in django where i had to extract frames from some part of the video by cropping the video first. Here is the sample code [crop and frames extraction code][1]
def saveFrame(request):
clip = VideoFileClip("hello.mp4")
clip = clip.subclip(0, 15)
clip = clip.cutout(3, 10)
clip.ipython_display(width = 360)
cap= cv2.VideoCapture('__temp__.mp4')
i=0
while cap.isOpened():
ret, frame = cap.read()
if ret == False:
break
cv2.imwrite('media/images/frames/'+str(i)+'.jpg',frame)
print(i)
i+=1
cap.release()
cv2.destroyAllWindows()
My video is located in the same directory but still when i run this code i get this error
MoviePy error: the file hello.mp4 could not be found! Please check that you entered the correct path.
Can anyone help me in solving this error? Thanks.