Corrupt JPEG data: premature end of data segment [GSPCA v2]
Question
Hi.
I'm trying to use a USB
WebCam using GSPCA v2 (with
V4L2) but I'm getting [1] Corrupt JPEG data: premature end of data segment. The camera is working only on Ekiga with no problem using
V4L2.
I tried before with a GSPCA V1 (with
V4L1) and It worked in Motion but I was getting a black dotted bar in the bottom of the stream. (I was getting that bar also on other software). So for that reason I decided to try the new driver.
[0] Processing thread 0 - config file motion.conf
[0] Motion 3.2.9 Started
[0] ffmpeg LIBAVCODEC_BUILD 3352064 LIBAVFORMAT_BUILD 3344896
[0] Thread 1 is from motion.conf
[1] Thread 1 started
[1] cap.driver: "zc3xx"
[1] cap.card: "USB Camera (046d:089d)"
[1] cap.bus_info: "usb-0000:02:0a.1-2"
[1] cap.capabilities=0x05000001
[1] - VIDEO_CAPTURE
[1] - READWRITE
[1] - STREAMING
[1] Supported palettes:
[1] 0: JPEG (JPEG)
[1] Test palette JPEG (320x240)
[1] Using palette JPEG (320x240) bytesperlines 320 sizeimage 29390 colorspace 00000007
[1] found control 0x00980900, "Brightness", range 0,255
[1] "Brightness", default 128, current 127
[1] found control 0x00980901, "Contrast", range 0,256
[1] "Contrast", default 128, current 128
[1] found control 0x00980910, "Gamma", range 1,6
[1] "Gamma", default 4, current 3
[1] found control 0x00980912, "Auto Gain", range 0,1
[1] "Auto Gain", default 1, current 1
[1] mmap information:
[1] frames=4
[1] 0 length=32768
[1] 1 length=32768
[1] 2 length=32768
[1] 3 length=32768
[0] motion-httpd/3.2.9 running, accepting connections
[0] motion-httpd: waiting for data on port TCP 8001
[1] Using V4L2
[1] Error capturing first image
[1] Thread finishing...
egorian@ubuntuServer:~$ sudo motion -d20 -c motion.conf
[0] Processing thread 0 - config file motion.conf
[0] Motion 3.2.9 Started
[0] ffmpeg LIBAVCODEC_BUILD 3352064 LIBAVFORMAT_BUILD 3344896
[0] Thread 1 is from motion.conf
[1] Thread 1 started
[1] cap.driver: "zc3xx"
[1] cap.card: "USB Camera (046d:089d)"
[1] cap.bus_info: "usb-0000:02:0a.1-2"
[1] cap.capabilities=0x05000001
[1] - VIDEO_CAPTURE
[1] - READWRITE
[1] - STREAMING
[1] v4l2_select_input: name = "zc3xx", type 0x00000002, status 00000000
[1] - CAMERA
[1] Device doesn't support VIDIOC_G_STD
[1] Supported palettes:
[1] 0: JPEG (JPEG)
[1] Test palette JPEG (320x240)
[1] Using palette JPEG (320x240) bytesperlines 320 sizeimage 29390 colorspace 00000007
[1] found control 0x00980900, "Brightness", range 0,255
[1] "Brightness", default 128, current 127
[1] found control 0x00980901, "Contrast", range 0,256
[1] "Contrast", default 128, current 128
[1] found control 0x00980910, "Gamma", range 1,6
[1] "Gamma", default 4, current 3
[1] found control 0x00980912, "Auto Gain", range 0,1
[1] "Auto Gain", default 1, current 1
[1] mmap information:
[1] frames=4
[1] 0 length=32768
[1] 1 length=32768
[1] 2 length=32768
[1] 3 length=32768
[0] motion-httpd/3.2.9 running, accepting connections
[0] motion-httpd: waiting for data on port TCP 8001
[1] Using V4L2
[1] processing jpeg image - content length 2044
[1] Corrupt JPEG data: premature end of data segment
[1] processing jpeg image - content length 2044
[1] Corrupt JPEG data: premature end of data segment
[1] processing jpeg image - content length 2044
[1] Corrupt JPEG data: premature end of data segment
[1] processing jpeg image - content length 2044
[1] Corrupt JPEG data: premature end of data segment
[1] processing jpeg image - content length 2044
[1] Corrupt JPEG data: premature end of data segment
[1] processing jpeg image - content length 2044
[1] Corrupt JPEG data: premature end of data segment
[1] processing jpeg image - content length 2044
[1] Corrupt JPEG data: premature end of data segment
[1] processing jpeg image - content length 2044
[1] Corrupt JPEG data: premature end of data segment
[1] processing jpeg image - content length 2044
[1] Corrupt JPEG data: premature end of data segment
[1] processing jpeg image - content length 2044
[1] Corrupt JPEG data: premature end of data segment
[1] Error capturing first image
[1] Thread finishing...
Environment
Motion version: |
3.2.9 |
ffmpeg version: |
SVN |
Libraries: |
ffmpeg, mysql, postgresql |
Server OS: |
Ubuntu 8.04.3 LTS |
--
EstuardoGorian - 03 Sep 2009
Follow Up
Please try latest stable version of motion 3.2.11.1 .
--
AngelCarpintero - 03 Sep 2009
_______________________________________________________
I updated to 3.2.11.1 and I'm getting the following output:
:~$ motion -d 9 -c motion.conf
[0] Processing thread 0 - config file motion.conf
[0] Unknown config option "night_compensate"
[0] Unknown config option "low_cpu"
[0] Unknown config option "sql_log_image"
[0] Unknown config option "sql_log_snapshot"
[0] Unknown config option "sql_log_mpeg"
[0] Unknown config option "sql_log_timelapse"
[0] Unknown config option "sql_query"
[0] Motion 3.2.11.1 Started
[0] ffmpeg LIBAVCODEC_BUILD 3352064 LIBAVFORMAT_BUILD 3344896
[0] Thread 1 is from motion.conf
[1] Thread 1 started
[1] cap.driver: "zc3xx"
[1] cap.card: "USB Camera (046d:089d)"
[1] cap.bus_info: "usb-0000:02:0a.1-2"
[1] cap.capabilities=0x05000001
[1] - VIDEO_CAPTURE
[1] - READWRITE
[1] - STREAMING
[1] v4l2_select_input: name = "zc3xx", type 0x00000002, status 00000000
[1] - CAMERA
[1] Device doesn't support VIDIOC_G_STD
[1] Supported palettes:
[1] 0: JPEG (JPEG)
[1] index_format 3 Test palette JPEG (320x240)
[1] Using palette JPEG (320x240) bytesperlines 320 sizeimage 29390 colorspace 00000007
[1] found control 0x00980900, "Brightness", range 0,255
[1] "Brightness", default 128, current 6
[1] found control 0x00980901, "Contrast", range 0,256
[1] "Contrast", default 128, current 128
[1] found control 0x00980910, "Gamma", range 1,6
[1] "Gamma", default 4, current 3
[1] found control 0x00980912, "Auto Gain", range 0,1
[1] "Auto Gain", default 1, current 1
[1] mmap information:
[1] frames=4
[1] 0 length=32768
[1] 1 length=32768
[1] 2 length=32768
[1] 3 length=32768
[0] motion-httpd/3.2.11.1 running, accepting connections
[0] motion-httpd: waiting for data on port TCP 8001
[0] DEBUG-2 threads_running 1 motion_threads_running 1 , finish 0
[0] DEBUG-2 threads_running 1 motion_threads_running 1 , finish 0
[1] Using V4L2
[1] Resizing pre_capture buffer to 1 items
[1] setting control "Brightness" to 16 (ret 0 )
Corrupt JPEG data: premature end of data segment
[1] mjpegtoyuv420p: Corrupt image ... continue
[0] DEBUG-2 threads_running 1 motion_threads_running 1 , finish 0
[0] DEBUG-2 threads_running 1 motion_threads_running 1 , finish 0
[1] setting control "Brightness" to 6 (ret 0 )
Corrupt JPEG data: premature end of data segment
[1] mjpegtoyuv420p: Corrupt image ... continue
[0] DEBUG-2 threads_running 1 motion_threads_running 1 , finish 0
[0] DEBUG-2 threads_running 1 motion_threads_running 1 , finish 0
[1] setting control "Brightness" to 21 (ret 0 )
Corrupt JPEG data: premature end of data segment
[1] mjpegtoyuv420p: Corrupt image ... continue
[0] DEBUG-2 threads_running 1 motion_threads_running 1 , finish 0
[0] DEBUG-2 threads_running 1 motion_threads_running 1 , finish 0
[1] setting control "Brightness" to 36 (ret 0 )
Corrupt JPEG data: premature end of data segment
[1] mjpegtoyuv420p: Corrupt image ... continue
[0] DEBUG-2 threads_running 1 motion_threads_running 1 , finish 0
[0] DEBUG-2 threads_running 1 motion_threads_running 1 , finish 0
[1] setting control "Brightness" to 51 (ret 0 )
Corrupt JPEG data: premature end of data segment
[1] mjpegtoyuv420p: Corrupt image ... continue
[0] DEBUG-2 threads_running 1 motion_threads_running 1 , finish 0
[0] DEBUG-2 threads_running 1 motion_threads_running 1 , finish 0
[1] Error capturing first image
[1] Started stream webcam server in port 8111
[1] Resizing pre_capture buffer to 5 items
[1] setting control "Brightness" to 41 (ret 0 )
Corrupt JPEG data: premature end of data segment
[1] mjpegtoyuv420p: Corrupt image ... continue
[1] vid_return_code 2
[1] setting control "Brightness" to 31 (ret 0 )
Corrupt JPEG data: premature end of data segment
[1] mjpegtoyuv420p: Corrupt image ... continue
[1] vid_return_code 2
[0] DEBUG-2 threads_running 1 motion_threads_running 1 , finish 0
[1] setting control "Brightness" to 21 (ret 0 )
Corrupt JPEG data: premature end of data segment
[1] mjpegtoyuv420p: Corrupt image ... continue
[1] vid_return_code 2
[1] setting control "Brightness" to 11 (ret 0 )
Corrupt JPEG data: premature end of data segment
[1] mjpegtoyuv420p: Corrupt image ... continue
[1] vid_return_code 2
[1] setting control "Brightness" to 1 (ret 0 )
Corrupt JPEG data: premature end of data segment
[1] mjpegtoyuv420p: Corrupt image ... continue
[1] vid_return_code 2
Corrupt JPEG data: premature end of data segment
[1] mjpegtoyuv420p: Corrupt image ... continue
[1] vid_return_code 2
[0] DEBUG-2 threads_running 1 motion_threads_running 1 , finish 0
Corrupt JPEG data: premature end of data segment
[1] mjpegtoyuv420p: Corrupt image ... continue
[1] vid_return_code 2
Corrupt JPEG data: premature end of data segment
[1] mjpegtoyuv420p: Corrupt image ... continue
[1] vid_return_code 2
Corrupt JPEG data: premature end of data segment
[1] mjpegtoyuv420p: Corrupt image ... continue
[1] vid_return_code 2
Corrupt JPEG data: premature end of data segment
[1] mjpegtoyuv420p: Corrupt image ... continue
[1] vid_return_code 2
[0] DEBUG-2 threads_running 1 motion_threads_running 1 , finish 0
Corrupt JPEG data: premature end of data segment
[1] mjpegtoyuv420p: Corrupt image ... continue
[1] vid_return_code 2
Corrupt JPEG data: premature end of data segment
[1] mjpegtoyuv420p: Corrupt image ... continue
[1] vid_return_code 2
[1] Thread exiting
[1] Calling vid_close() from motion_cleanup
[1] Closing video device /dev/video0
[0] DEBUG-1 threads_running 0 motion_threads_running 0 , finish 1
[0] httpd - Finishing
[0] httpd Closing
[0] httpd thread exit
[0] Motion terminating
--
EstuardoGorian - 03 Sep 2009
Answer
You can try to ignore warning of jpeg :
if (ret == 1) {
if (debug_level >= CAMERA_WARNINGS)
motion_log(LOG_ERR, 0, "%s: Corrupt image ... continue", __FUNCTION__);
ret = 2;
}
Replacing ret = 2 to ret = 0 :
sed -ie 's/ret = 2/ret = 0/g' video_common.c
And build again motion ( make ; sudo make install )
--
AngelCarpintero - 04 Sep 2009
Thanks for your help Angel.
I forced to ignore the jpeg warning and I got an image from Motion. But I'm still getting an image with a bar at the bottom as using
V4L1.
I posted an image example (
http://img245.imageshack.us/i/screenshotwebcam.jpg/) at the bottom of the image there is a gray bar.
Do you think this is a problem with a buggy driver?
--
EstuardoGorian - 04 Sep 2009
Yah , looks like the issue is in the driver, JPEG works good with uvcvideo driver.
--
AngelCarpintero - 04 Sep 2009