Home > fourcc python > cv_fourcc error

Cv_fourcc Error


here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack error: (-215) dst.data == dst0.data in function cvcvtcolor Overflow the company Business Learn more about hiring developers or posting ads with us Stack opencv fourcc python Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community cv_fourcc opencv of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Python OpenCV2 cv2.cv_fourcc not working with VideoWriter up vote 8 down vote favorite 2 As the title

Cv_fourcc Mp4

states, when I run the cv2.videowriter function I get 'module' object has no attribute CV_FOURCC. Code: # Creates a video file from webcam stream import cv2 Create test window cv2.namedWindow("cam_out", cv2.CV_WINDOW_AUTOSIZE) # Create vid cap object vid = cv2.VideoCapture(1) # Create video writer object vidwrite = cv2.VideoWriter(['testvideo', cv2.CV_FOURCC('M','J','P','G'), 25, (640,480),True]) python opencv share|improve this question edited Sep 30 at 10:07 JohnAllen 1,96342033 asked Mar 23 '13 at 7:56 user2197517 41112 cv2.videowriter example What is the question exactly? –Kyle Maxwell Mar 28 '13 at 4:19 add a comment| 3 Answers 3 active oldest votes up vote 17 down vote Kind of late to the party, but if anyone needs it for newer versions of opencv2, then the command is: cv2.VideoWriter_fourcc(c1, c2, c3, c4) share|improve this answer answered Feb 19 '14 at 1:22 cgf 1,20011629 1 It doesn't work for me, it's a quite unclear answer..... –G M Jul 14 at 11:06 add a comment| up vote 13 down vote Change cv2.CV_FOURCC('M','J','P','G') to cv2.cv.CV_FOURCC('M','J','P','G'). share|improve this answer edited Oct 14 '14 at 15:47 Rose Perrone 28k20136157 answered Apr 4 '13 at 15:06 armadefuego 1392 2 or even cv2.cv.CV_FOURCC(*'MJPG') –ntg Jan 10 '15 at 20:21 cv module is gone in latest version –hoju Jun 14 '15 at 8:48 3 These days you would use cv2.VideoWriter_fourcc(*'MJPG') –SiggyF Mar 25 at 11:46 add a comment| up vote 1 down vote For OpenCV 3 do this: cv2.VideoWriter_fourcc(*'MJPG') credit @SiffgyF share|improve this answer answered Sep 23 at 8:38 JohnAllen 1,96342033 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and Password Post as a guest Name Email P

nklatt 16 ●1 ●1 ●4 updated 2013-05-06 11:29:42 -0500 Howdy, I am using the VideoWriter class to capture video from a camera to a file. I am doing CV in the code as well, of course, but cv_fourcc opencv 3 am adding video capture to help troubleshoot and optimize. I am able to capture the


video if I pass the magic number "-1" as the fourcc parameter, like so: outputVideo = new cv::VideoWriter(outputVideo_name, -1, 20, img_rgb.size(),

Cv_fourcc Python

true); I select "Microsoft Video 1" from the dropdown and it generates a video file using the CRAM codec. However, if I replace that "-1" with "CV_FOURCC('C','R','A','M')", it says it's capturing video but the file is http://stackoverflow.com/questions/15584608/python-opencv2-cv2-cv-fourcc-not-working-with-videowriterb always 6kB and does not play. Using MSVC or WHAM produces similar results. I am running on Windows 7 with a PS3 Eye camera using the CL-Eye driver and OpenCV 2.4.1, compiled with Eclipse and MinGW's g++ (GCC) 4.5.2. Any ideas on what I might be doing wrong? Thanks, Nathan ===== EDIT: Images showing binary differences between now-working and working generated video files: (Here there be zeros.) edit retag flag offensive close merge http://answers.opencv.org/question/12959/videowriter-fourcc-1-works-but-cv_fourcccram-does-not/ delete CommentsFOURCC supports a very large amount of codecs, but in my experience, aside from the major codecs, whether the codec actually works varies. In my experience, I just try the different codecs until one works. http://www.fourcc.org/codecs.php lists 'CRAM' as one of their supported codecs, but it also says that it is allegedly simialr to 'MSVC'. Another codec listed is 'WHAM'. Maybe give these a try?HD_Mouse( 2013-05-06 13:26:06 -0500 )editYeah, I did try those for that same reason but no joy. I used CRAM first since that is what is embedded in the working video file, as you can see in the first image - easier to see if you view it full-size.I also have the same result with IYUV which is a better-regarded codec but it's the same deal - it works if I select it from the dropdown but not if I direct VideoWriter to use that codec from the code.I feel like I must be doing something more basic wrong like improperly mixing C and C++ interfaces or something, maybe?nklatt( 2013-05-07 08:36:47 -0500 )editI think you can reduce this to your operating system not having the necessary codecs. Could you install a software package with the most random codecs inside, like VLC media player and see if it gets solved?StevenPuttemans( 2013-05-07 1

12:52:10 -0500 berak 12920 ●2 ●61 ●203 I am using http://answers.opencv.org/question/29816/cv_fourcc-was-not-declared-in-this-scope/ Opencv 3.0.0 dev on Ubuntu 12.04 and calling CV_FOURCC. http://answers.opencv.org/question/27902/how-to-record-video-using-opencv-and-python/ Did I miss any header file or the name of macro is changed in the latest version? I have using namespace cv already, and including opencv2/core/core.hpp> and opencv2/highgui/highgui.hpp. Some other macros are also missing such as CV_SORT_ASCENDING, CV_StsNotImplemented. edit fourcc python retag flag offensive close merge delete Commentsyes, all true. most constants in 3.0 lost the CV_ prefix and live instead in the cv:: namespace.also, the old CV_FOURCC macro was replaced by VideoWriter::fourcc()berak( 2014-03-11 12:51:02 -0500 )editadd a comment Login/Signup to Answer Question Tools Follow subscribe to rss feed Stats error: (-215) dst.data Asked: 2014-03-11 12:32:10 -0500 Seen: 1,677 times Last updated: Mar 11 '14 Related questions cannot import xfeatures2d in OpenCV 3- Python binding Running a Java Program Referencing OpenCV's Jar File CvMat vs cv::Mat data pointer Creating a sub array of a Mat throws assertion error v3.0 on linux: undefined reference to `cv::Mat:: OpenCV4Android 3 with extra modules for 32 and 64 bit OpenCV 3.1 VideoWriter::write(const Mat&) does not return its status. How do i run OpenCV programs using the Xeon Phi accelerators ? ShapeContext Java OpenCV 3.0.0 Tutorials for iOS deprecated Copyright Itseez, 2012-2016. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license. about | faq | help | privacy policy Powered by Askbot version 0.7.53 Please note: OpenCV answers requires javascript to work properly, please enable javascript in your browser, here is how ( 2016-10-06 04:09:31 -0500 )editnone

I have looked at OpenCV's Python example on how to use VideoCapture and VideoWriter to capture and write out a video file. But I keep getting: OpenCV Error: Assertion failed (dst.data == dst0.data) in cvCvtColor, file /tmp/opencv-n8PM/opencv-, line 4422 Traceback (most recent call last): File "examples/observer/observer.py", line 17, in video_writer.write(frame) cv2.error: /tmp/opencv-n8PM/opencv- error: (-215) dst.data == dst0.data in function cvCvtColor Cleaned up camera. Here is the code: #!/usr/bin/env python import cv2 if __name__ == "__main__": # find the webcam capture = cv2.VideoCapture(0) # video recorder fourcc = cv2.cv.CV_FOURCC(*'XVID') # cv2.VideoWriter_fourcc() does not exist video_writer = cv2.VideoWriter("output.avi", fourcc, 20, (680, 480)) # record video while (capture.isOpened()): ret, frame = capture.read() if ret: video_writer.write(frame) cv2.imshow('Video Stream', frame) else: break capture.release() video_writer.release() cv2.destroyAllWindows() edit retag flag offensive close merge delete add a comment 1 answer Sort by ยป oldest newest most voted 1 answered 2014-02-17 19:34:32 -0500 payashim 11 ●1 http://derivecv.tumblr... Please make sure your input 'frame' size is equal to output video's size (in this case, (680, 480) ). I previously got this error when the input image size is different from videowriter's out put size setting. edit flag offensive delete link more Commentssigh I wish people would post more complete, helpful answers. I was able to get this to work by explicitly changing the widthxheight of the captured stream like this:# find the webcam capture = cv2.VideoCapture(0) capture.set(3,640) capture.set(4,480) MAC OS :10.10.5 Python: 2.7.9 OpenCV: 3.1.0frakman1( 2016-03-18 14:21:59 -0500 )editFurthermore, I had to change 'XVID' to 'MJPG' before it would play back the recorded file correctly.fourcc = cv2.VideoWriter_fourcc(*'MJPG') frakman1( 2016-03-18 14:29:09 -0500 )editI could only get VideoWriter to work by using the same frame as my video capture and using this codec: mp4v (lowercase):cap = cv2.VideoCapture(0) w = cap.get(cv2.CAP_PROP_FRAME_WIDTH); h = cap.get(cv2.CAP_PROP_FRAME_HEIGHT); fourcc = cv2.VideoWriter_fourcc(*'mp4v') out = cv2.VideoWriter('output.mp4',fourcc, 15.0, (int(w),int(h))) Mac OS X El Capitan 10.11.3 with Python 2.7.11, OpenCV 3.1.0rpcarn( 2016-03-21 14:06:40 -0500 )editadd a comment Login/Signup to Answer Question


Related content

No related pages.