Motion - Support Question 2007x 01x 24x 124733

MJPEG V4L2_PIX_FMT_MJPEG - Error capturing first image

Question

Hi again,

This is continue question for "Unable to find a compatible palette format with Logitech Sphere." case Support Question 2007x 01x 14x 033716

Camera is (Bus 001 Device 002: ID 046d:08c2 Logitech, Inc.). Logitech Sphere.

Motion will now start nicely without errors, but then stops in few seconds with error: "[1] Error capturing first image"

[0] Processing thread 0 - config file /usr/local/etc/motion.conf
[0] Motion running in setup mode.
[0] Thread 1 is from /usr/local/etc/motion.conf
[0] Thread 1 is device: /dev/video1 input 8
[0] Waiting for threads to finish, pid: 10952
[1] Thread started
[1] cap.driver: "uvcvideo"
[1] cap.card: "USB Video Class device"
[1] cap.bus_info: "0000:00:07.2"
[1] cap.capabilities=0x04000001
[1] - VIDEO_CAPTURE
[1] - STREAMING
[1] v4l2_select_input: name = "Camera", type 0x00000002, status 00000000
[1] - CAMERA
[1] Device doesn't support VIDIOC_G_STD
[1] Supported palettes:
[1] 0: MJPG (MJPEG)
[0] motion-httpd/3.2.8 running, accepting connections
[0] motion-httpd: waiting for data on port TCP 8080
[1] Using palette MJPG (320x240)
[1] found control 0x00980900, "Brightness", range 0,255
[1]     "Brightness", default 127, current 127
[1] found control 0x00980901, "Contrast", range 0,255
[1]     "Contrast", default 32, current 32
[1] found control 0x00980902, "Saturation", range 0,255
[1]     "Saturation", default 39, current 39
[1] found control 0x00980913, "Gain", range 0,255
[1]     "Gain", default 0, current 16
[1] found control 0x08000000, "Backlight Compensation", range 0,2
[1]     "Backlight Compensation", default 1, current 1
[1] found control 0x08000001, "Power Line Frequency", range 0,2
[1]     "Power Line Frequency", default 2, current 2
[1] mmap information:
[1] frames=4
[1] 0 length=42666
[1] 1 length=42666
[1] 2 length=42666
[1] 3 length=42666
[1] Using V4L2
[1] Error capturing first image
[1] Thread finishing...

Environment

Motion version: 3.2.8 svn revision 163
ffmpeg version:  
Libraries: ffmpeg
Server OS: Ubuntu 6.10 (Edgy Eft)

-- PeterBowle - 24 Jan 2007

Follow up

I think that you build motion with ffmpeg support , because it's mandatory to work with MJPEG .

Anyway Did you see any other message in log files ( /var/log/messages or /var/log/syslog ) ?

Because i don't see above what was the error in vid_next().

-- AngelCarpintero - 24 Jan 2007

Question

Ok, after compiling with ffmpeg support: (ffmpeg version information):

FFmpeg version SVN-rUNKNOWN, Copyright (c) 2000-2004 Fabrice Bellard
  configuration:  --enable-gpl --enable-pp --enable-pthreads --enable-vorbis --enable-libogg --enable-a52 --enable-dts --enable-libgsm --enable-dc1394 --disable-debug --enable-shared --prefix=/usr
  libavutil version: 0d.49.0.0
  libavcodec version: 0d.51.11.0
  libavformat version: 0d.50.5.0
  built on Sep 20 2006 00:26:15, gcc: 4.1.2 20060906 (prerelease) (Ubuntu 4.1.1-13ubuntu2)

I get more detailed error message from motion:

[1] Using V4L2
[1] outbuf size mismatch. pic_size 153600  bufsize: 230400: Invalid argument
[1] outbuf size mismatch. pic_size 153600  bufsize: 230400: Invalid argument
[1] outbuf size mismatch. pic_size 153600  bufsize: 230400: Invalid argument
[1] outbuf size mismatch. pic_size 153600  bufsize: 230400: Invalid argument
[1] outbuf size mismatch. pic_size 153600  bufsize: 230400: Invalid argument
[1] outbuf size mismatch. pic_size 153600  bufsize: 230400: Invalid argument
[1] outbuf size mismatch. pic_size 153600  bufsize: 230400: Invalid argument
[1] outbuf size mismatch. pic_size 153600  bufsize: 230400: Invalid argument
[1] outbuf size mismatch. pic_size 153600  bufsize: 230400: Invalid argument
[1] outbuf size mismatch. pic_size 153600  bufsize: 230400: Invalid argument
[1] Error capturing first image
[1] Thread finishing...

Follow up

I'm trying to fix that problem , but i have no any webcam with MJPEG palette support so it's not easy to fix it in "blind" way.

-- AngelCarpintero - 26 Jan 2007

Question

With revision 166 error message is:

[1] Using V4L2
[1] Not a JPEG file: starts with 0x4b 0x47
[1] Not a JPEG file: starts with 0x4f 0x4b
[1] Not a JPEG file: starts with 0x4e 0x4d
[1] Not a JPEG file: starts with 0x4d 0x4b
[1] Not a JPEG file: starts with 0x4e 0x4c
[1] Not a JPEG file: starts with 0x4c 0x4a
[1] Not a JPEG file: starts with 0x4c 0x49
[1] Not a JPEG file: starts with 0x4e 0x4a
[1] Not a JPEG file: starts with 0x4d 0x48
[1] Not a JPEG file: starts with 0x41 0x39
[1] Error capturing first image
[1] Thread finishing...

Follow Up

Well i fixed the previous issue with the buffer size , but seems that still there's a bug around. The logs messages you posted are from the decompress process , so i guess the problem is that MJPEG is not well parsed or the huffman table are not added correctly. Let me see ...

-- AngelCarpintero - 31 Jan 2007

Answer

I've fixed MJPEG issues in motion svn -r167.

Give a try ... some imagen distorsion may happen. I'll try to see where is the problem maybe libavcodec decompression/conversion .

-- AngelCarpintero - 31 Jan 2007

Comment

Ok problem solved! smile Colors needs some tuning, but it works pretty well.
Topic revision: r8 - 02 Feb 2007, PeterBowle
Copyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Please do not email Kenneth for support questions (read why). Use the Support Requests page or join the Mailing List.
This website only use harmless session cookies. See Cookie Policy for details. By using this website you accept the use of these cookies.