AttributeError: 'module' object has no attribute 'VideoWriter_fourcc'
2016-12-11 15:10
706 查看
AttributeError: 'module' object has no attribute 'VideoWriter_fourcc'
VideoWriter_fourccpython
asked
Mar 9 '14
symon6
1
●1
●1 ●1
updated
Mar 26 '14
berak
13969
●2
●65 ●209
I am trying to capture video throught this tutorial:
http://opencv-python-tutroals.readthedocs.org/en/latest/py_tutorials/py_gui/py_video_display/py_video_display.html
but when I try to use the last source code I give this error message:
python record_video.py VIDIOC_QUERYMENU: Invalid argument VIDIOC_QUERYMENU: Invalid argument VIDIOC_QUERYMENU: Invalid argument VIDIOC_QUERYMENU: Invalid argument VIDIOC_QUERYMENU: Invalid argument VIDIOC_QUERYMENU: Invalid argument VIDIOC_QUERYMENU: Invalid argument Traceback (most recent call last): File "record_video.py", line 7, in <module> fourcc = cv2.VideoWriter_fourcc() AttributeError: 'module' object has no attribute 'VideoWriter_fourcc'
Sorry for my English :)
edit
add a comment
2 answers
Sort by » oldestnewestmostvoted
5
answered
Mar 26 '14
pjthakkar3192
51
●1
●2
actually i was also stuck to this code, instead of this code fourcc = cv2.videowriter_fourcc(*'XVID')
write this code it works fine with me fourcc = cv2.cv.CV_FOURCC(*'XVID')
edit
link
Comments
where you know this code " fourcc = cv2.cv.CV_FOURCC(*'XVID')" ? sory, I have much to learn from you. #newbiewibowo (Dec
8 '14)
where You can code "fourcc = cv2.cv.CV_FOURCC(*'XVID')"? Sory newbie, I have much to learn from you.
wibowo (Dec
8 '14)
http://answers.opencv.org/question/44...
It depends on OpenCV version you use.
Want you to know where it said which use? http://opencv-python-tutroals.readthe... This is lastest (for 3.0 which is in-development ;) ) and there are descriptions about settings (keyword - FourCC)
When want to see for 2.4.* do sth like this:
copy repository from GitHub (be sure you have
git)
git checkout 2.4.9
grep -rni xvid
You will see sth like: ... modules/highgui/src/cap_gstreamer.cpp:474: encs[CV_FOURCC('X','V','I','D')]=(char*)"xvidenc"; ... then see: modules/highgui/doc/reading_and_writing_images_and_video.rst
Have fun :)
volodia (Oct
8 '15)
add a comment
0
answered
Oct 8 '15
volodia
16
●5
updated
Oct 8 '15
To be sure that you have answer for your question.
>> import cv2 >> cv2.__version__ 2.4.9.1 >>> fourcc = cv2.VideoWriter_fourcc() Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'module' object has no attribute 'VideoWriter_fourcc'
That means there is no
cv2.VideoWriter_fourcc()because it exsist from 3.0 ver. but you using 2.4.9.1 :)
When you use that version you should change that for
fourcc = cv2.cv.CV_FOURCC(*'XVID')like
@pjthakkar3192 said before. (if you want to support 2.4.* and 3.* ver of OpenCV just check if func is callable -
callable(cv2.cv.CV_FOURCC))
Best regards.
edit
link
add a comment
相关文章推荐
- 解决方法——AttributeError: 'module' object has no attribute 'VideoWriter_fourcc'
- AttributeError: 'module' object has no attribute 'AF_INET'
- AttributeError: 'module' object has no attribute 'text_format'
- AttributeError: 'module' object has no attribute 的解决方法
- AttributeError: 'module' object has no attribute 'LabelMap'
- AttributeError: 'module' object has no attribute 'LabelMap'
- AttributeError: 'module' object has no attribute 'showinfo'(已解决)
- AttributeError: 'module' object has no attribute 'text_format'
- AttributeError: 'module' object has no attribute '_base' 可行解决办法
- Keras深度学习框架学习笔记(3) - AttributeError:’module’ object has no attribute ‘ifelse’错误信息的解决方法
- AttributeError: 'module' object has no attribute 'best_partition'
- 【TensorFlow问题】AttributeError:'module' object has no attribute 'mul'
- [置顶] AttributeError: 'module' object has no attribute '_base' 可行解决办法
- AttributeError: 'module' object has no attribute 'text_format'
- AttributeError: 'module' object has no attribute 'XXX'
- AttributeError: 'module' object has no attribute '_handlerList' 错误解决方法
- AttributeError: 'module' object has no attribute 'text_format'
- AttributeError: 'module' object has no attribute 'Serial'
- 使用旧版本tensorflow出现了negative等报错的问题,AttributeError: 'module' object has no attribute 'xxx'"
- AttributeError:'module' object has no attribute 'classify'