Ask Your Question
1

USB_Cam, Could not open MJPEG Decoder

asked 2011-07-09 06:06:20 -0500

davidcw gravatar image

Whenever I run usb_cam with pixel_format:="mjpeg", I get the following error:

usb_cam video_device set to [/dev/video1]
...
usb_cam pixel_format set to [mjpeg]
[mjpeg @ 0x7fabe40f0160]codec type or id mismatches
Could not open MJPEG Decoder
Segmentation Fault

I'm using a Logitech Webcam Pro 9000, on Ubuntu 11.04, with the latest "usb_cam" downloaded from the bosch-ros-pkg repository. usb_cam works great when I set pixel_format to "yuyv", and I can see the image with image_view. However, the frame rates for "mjpeg" should be 4x higher than "yuyv" at this camera's native resolution (according to the list at http://www.quickcamteam.net/devices/l... ). I would ultimately like to use this webcam to track a 'fast' moving target, one that I should be able to catch at 30fps, but not reliably catch 5-7.5 fps.

I've installed ffmpeg and libavcodec-dev from Ubuntu's software center. I'd be happy to supply any additional information, but I'm not sure what to look for.

  • Thanks!
edit retag flag offensive close merge delete

Comments

The link below: https://code.ros.org/trac/opencv/tick... seems broken. Does anyone has an answer to this? Same problem here. I am using Indigo, usb_cam and Ubuntu 14.04.

cvcook gravatar image cvcook  ( 2015-07-09 20:46:22 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2011-08-31 09:58:10 -0500

mgb gravatar image

I fixed up CvCaptureCAM_DShow to allow MJPG and setting of all the webcam parameters. Fixes are against 2.3.0 see https://code.ros.org/trac/opencv/ticket/1281

edit flag offensive delete link more
0

answered 2011-09-05 20:52:09 -0500

rado0x54 gravatar image

updated 2011-09-05 20:56:32 -0500

Patch your usb_cam.cpp. This should fix the error.

--- usb_cam.cpp (revision 628)
+++ usb_cam.cpp (working copy)
@@ -296,6 +296,7 @@
   avpicture_alloc((AVPicture *)avframe_rgb, PIX_FMT_RGB24, image_width, image_height);

   avcodec_context->codec_id = CODEC_ID_MJPEG;
+  avcodec_context->codec_type = AVMEDIA_TYPE_VIDEO;
   avcodec_context->width = image_width;
   avcodec_context->height = image_height;
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2011-07-09 06:06:20 -0500

Seen: 1,849 times

Last updated: Sep 05 '11