VideoWriter issues
I'm trying to save a video but I have really problems, because I create the video but when I try to play it doesn't work just stay black. I try to follow the opencv documentation but it didn't works.
https://opencv-python-tutroals.readth...
Im on win10, maybe its important to know...?
A piece of code:
import numpy as np
import cv2
cap = cv2.VideoCapture("myVideo.mp4")
fourcc = cv2.VideoWriter_fourcc(*'XVID')
out = cv2.VideoWriter('newVideo.avi',fourcc, 20.0, (640,480))
while(cap.isOpened()):
grabbed, frame = cap.read()
if (grabbed==True):
frame = cv2.flip(frame,0)
out.write(frame)
cv2.imshow('frame',frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
else:
break
cap.release()
out.release()
cv2.destroyAllWindows()
Does it work with MJPG?
I tryed but it doesnt work, thank you for response:
First try this tutorial (saving a video) using your webcam
Thank you for your response but as I said, I practice with openCV tutorial and with webcam its works but not when you practice with a video. You know? I follow step by step what tutorial said but it doesnt work. :(
If it works with a webcam it means that you can save the video. Your problem is in cv2.VideoCapture("myVideo.mp4") ?
can you check video path ? what is your opencv version ? which codec is used in myVideo.mp4 ?
for libx264 you will need cisco dll
Yes, the video save in the correct folder, but when I try to execute it doesn't work... I downloaded codecs from fourcc.org but I have the same problem.
you must use cisco dll with opencv_ffmpeg
@WoFFeN88.At first posted doesn't and the links solved your probem and also the links. I have done this before last year by using raspberry pi camera and webcam. I do not have it with me right now. I think it is about 20 lines.
I dont understand what you try to say me... But I didn't solve the problem. I tried with many extensions, installing the codecs, following tutorials, and reading about in forums but nothing allow me to save the video correctly, just save the video on folder and when I click on it, doesn't work... I had been following even books of openCV... nothing happens... :( thank you for response.
@WoFFeN88You can't. It is not available on books, links, etc. playing mp4 to write avi is obsoleted. I will get back to you. Sorry for prevoiusly commeted. I erased some of my comment I will rephrased..At first posted and the links dosen't solved your problem.