Ask Your Question
0

opencv3.0 videowriter can't open encoder

asked 2017-12-12 08:28:48 -0600

when I use Videocapture of opencv2.x to save a video like video = VideoWriter("camera.avi", CV_FOURCC('X', 'V', 'I', 'D'), 32, cvSize(int(capture.get(CV_CAP_PROP_FRAME_WIDTH)), int(capture.get(CV_CAP_PROP_FRAME_HEIGHT))));

it is ok to open xvid encoder ,but when i use opencv3.0 xvid encoder is not open at all, I don't kown how to sovle this problem ,please help !!!!!

edit retag flag offensive close merge delete

Comments

which os ?

berak gravatar imageberak ( 2017-12-12 08:38:12 -0600 )edit

run in windows 10

westwind gravatar imagewestwind ( 2017-12-12 22:12:28 -0600 )edit

all functionality for that is inside the opencv_ffmpeg.dll . make sure it's on the PATH or next to your app

berak gravatar imageberak ( 2017-12-14 01:23:22 -0600 )edit

YES,I find problem is in opencv_ffmpeg.dll,when I delete it ,encoder opens.But another problem happened,because I use webcam, deleting opencv_ffmpeg.dll will make it broken down,what should I do,thanks

westwind gravatar imagewestwind ( 2017-12-30 04:27:33 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-12-13 14:04:09 -0600

supra56 gravatar image

updated 2017-12-13 14:14:01 -0600

You cannot used this: cvSize(int(capture.get(CV_CAP_PROP_FRAME_WIDTH)), int(capture.get(CV_CAP_PROP_FRAME_HEIGHT))));

frame_width = int(cap.get(3))
frame_height = int(cap.get(4))

# Define the codec and create VideoWriter object.The output is stored in 'outpy.avi' file.
out = cv2.VideoWriter('outpy.avi',cv2.VideoWriter_fourcc('M','J','P','G'), 10, (frame_width,frame_height))

Or if you prefer this:

# Define the codec and create VideoWriter object
fourcc = cv2.VideoWriter_fourcc(*'XVID')
out = cv2.VideoWriter('output.avi',fourcc, 20.0, (640,480))
edit flag offensive delete link more

Comments

i use the vs2013+opencv 3.0 , I think cvSize(int(capture.get(CV_CAP_PROP_FRAME_WIDTH)), int(capture.get(CV_CAP_PROP_FRAME_HEIGHT))) dont have problem,because it is ok when I save video ,just cant open encoder . I guess it's the problem of vision of opencv

westwind gravatar imagewestwind ( 2017-12-13 23:02:51 -0600 )edit

Why didn't you tell me before that you are using vs2013. Change this ('X', 'V', 'I', 'D'), 32 to ('X', 'V', 'I', 'D', '32')

supra56 gravatar imagesupra56 ( 2017-12-14 06:16:23 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2017-12-12 08:28:48 -0600

Seen: 1,273 times

Last updated: Dec 13 '17