Motion - Support Question 2008x 07x 24x 090621

Rotate doesn't work since 3.2.9-1

Question

I'm using motion with an Hercules/Guillemot Webcam (uvc, v4l2-only) Dualpix Exchange. Rotating by 180 degrees has no effect. When I try to rotate by 90/270 degrees I get an messy picture. However it seemsto be rotated (width/height are swapped).

First I was using the Ubuntu package (3.2.9-1) comes with the Hardy 8.04 repository. Then I tried the ubuntu .deb packages from the sourceforge website and found that version <=3.2.9 does the rotation right. Since version 3.2.9-1 rotating doesn't work.

When I use v3.2.9 I get errors like in this output:

[1] Using V4L2
Not a JPEG file: starts with 0xe4 0x0d
[1] Started stream webcam server in port 8081
Corrupt JPEG data: premature end of data segment
[1] File of type 8 saved to: /tmp/motion/01-20080724114550.avi
[1] File of type 1 saved to: /tmp/motion/01-20080724114550-00.jpg
[1] File of type 1 saved to: /tmp/motion/01-20080724114550-01.jpg
Is this a bug or are there any conditions in using the rotate feature?

Environment

Motion version: >=3.2.9-1
ffmpeg version:  
Libraries: ffmpeg, mysql, postgresql
Server OS: Ubuntu Hardy 8.04, kernel 2.6.24-19

-- WaldemarSpomer - 24 Jul 2008

FollowUp

Hi Waldemar,

First it's really a shame that debian / ubuntu deb packages are out of dates , a lot of messages / bugs / support request that has been fixed and released

in stable version.

I tried 3.2.9 / 3.2.10.x rotate works fine from motion.conf ( and thread*.conf files ) , tested with usb (pwc) and cctv cameras / capture cards.

Maybe the problem is only with uvc and MJPEG palette ?!

Or are you getting the problem changing rotate from web control ?

Please get current stable version and run without daemon mode with debug ( motion -d -n 7 ) and give more details about how / where / when

you get this issue. It's very hard to guess what is your problem without a good report.

-- AngelCarpintero - 24 Jul 2008

Reply

Hi Angel,

I think you're right: it seems to be a hardware/driver problem.

I tried the latest stable version on my Macbook and my Toshiba (like previously) and motion shows different "supported palettes":
  • on my Macbook:
    0: YUYV (...)
    1: MJPG (MJPEG)
    [...]
    Using palette YUYV ...
  • on my Toshiba:
    0: MJPG (MJPEG)
    [...]
    Using palette MJPG ...
    VIDIOC_G_JPEGCOMP not supported but it should (may be important)
Even when I set v4l2_palette 2 (for MJPG) motion uses YUYV.

So on my Macbook the rotation works well (with YUYV).
On may Toshiba (USB1) rotation doesn't work (with MJPG).

Because it seems to be a hardware/driver problem I continue looking at this part to solve my problem.

Thanks a lot!

-- WaldemarSpomer - 24 Jul 2008


Waldemar ,

I tested uvc webcam and there's a problem with MJPG palette as you told , so rotate doesn't work ( i'll fix it ) , but i cannot reproduce that

v4l2_palette 2 issue , there's another bug related :

http://www.lavrsen.dk/twiki/bin/view/Motion/UvcvideoMjpegPatch

Could you attach a full log and moton.conf content like i did in above bug , please ?

Thanks smile

-- AngelCarpintero - 25 Jul 2008

Rotation issues is fixed in trunk , but still waitting your feedback about v4l2_palette to fix and backport to 3.2.10 branch.

-- AngelCarpintero - 25 Jul 2008

First of all here's my log when I run motion (the latest stable for Hardy) on my Toshiba which has only USB 1.x:
user@toshiba:~$ motion -n -d 7
[0] Processing thread 0 - config file /etc/motion/motion.conf
[0] Motion 3.2.10.1 Started
[0] ffmpeg LIBAVCODEC_BUILD 3352064 LIBAVFORMAT_BUILD 3344896
[0] Thread 1 is from /etc/motion/motion.conf
[1] Thread 1 started
[1] cap.driver: "uvcvideo"
[1] cap.card: "Hercules Dualpix Exchange"
[1] cap.bus_info: "0000:00:1f.2"
[1] cap.capabilities=0x04000001
[1] - VIDEO_CAPTURE
[1] - STREAMING
[1] v4l2_select_input: name = "Camera 1", 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.10.1 running, accepting connections
[0] motion-httpd: waiting for data on port TCP 8080
[1] index_format 2 Test palette MJPG (640x480)
[1] Using palette MJPG (640x480) bytesperlines 0 sizeimage 307789 colorspace 00000008
[1] VIDIOC_G_JPEGCOMP not supported but it should

The corresponding motion.conf should be attached as motion.conf_toshiba.

I'm not sure how to test the trunk? So I'll do the following:
  • getting the source from the trunk from SVN
  • compile the stuff
  • test wether the ratation works
  • post feedback here wink

-- WaldemarSpomer - 25 Jul 2008


Ok as a quick answer , your webcam doesn't support YUVY , it only supports MJPG as motion shows , so you cannot

change to anything not supported by your drivers. v4l2_palette is used when motion shows multiple supported palettes.

You can get 3.2.10 branch as i committed there also the changes.

http://www.lavrsen.dk/twiki/bin/view/Motion/MotionSubversion

mkdir motion cd motion svn co http://www.lavrsen.dk/svn/motion/branches/3.2.10/ .
autoconf ; ./configure ; make ; sudo make install 
 

Be aware of :

motion will be installed in /usr/local/bin/motion and motion.conf in /usr/local/etc/motion.conf

-- AngelCarpintero - 25 Jul 2008


So here's my feedback:

I never installed software from source before big grin

At first I tried the installation from the trunk. The rotation worked fine. The picture quality was great :-D. But the server wasn't working and I had to reconnect the camera everytime I restarted motion.

Then I tried your advice and took the 3.2.10 branch. Here all seems to work fine. I compiled without ffmpeg so I couldn't test the videos.

The point with the color palette: As shown in my first reply, on my Macbook the YUYV palette was enabled. Maybe the USB1.x of my old Toshiba not supporting the YUYV, or the camera doesn't support it - anyway my Macbook has USB 2.0 and seems to support both YUYV and MJPEG.

Now I'll try to run on my Macbook again to check whether I can select both palettes.

-- WaldemarSpomer - 25 Jul 2008


So, on my Macbook motion prints the following:

[0] Processing thread 0 - config file /etc/motion/motion.conf
[0] Motion 3.2.10.branch-r394 Started
[0] Thread 1 is from /etc/motion/motion.conf
[1] Thread 1 started
[1] cap.driver: "uvcvideo"
[1] cap.card: "Hercules Dualpix Exchange"
[1] cap.bus_info: "0000:00:1d.7"
[1] cap.capabilities=0x04000001
[1] - VIDEO_CAPTURE
[1] - STREAMING
[1] v4l2_select_input: name = "Camera 1", type 0x00000002, status 00000000
[1] - CAMERA
[1] Device doesn't support VIDIOC_G_STD
[1] Supported palettes:
[1] 0: YUYV (YUV 4:2:2 (YUYV))
[1] 1: MJPG (MJPEG)
[0] motion-httpd/3.2.10.branch-r394 running, accepting connections
[0] motion-httpd: waiting for data on port TCP 8080
[1] index_format 6 Test palette YUYV (640x480)
[1] Using palette YUYV (640x480) bytesperlines 1280 sizeimage 614400 colorspace 
00000000

but in my /etc/motion.conf is set:
[...]
# Videodevice to be used for capturing  (default /dev/video0)
# for FreeBSD default is /dev/bktr0
videodevice /dev/video0

# v4l2_palette allow to choose preferable palette to be use by motion
# to capture from those supported by your videodevice. ( default: 8)
# i.ex if your videodevice supports V4L2_PIX_FMT_SBGGR8 and
# V4L2_PIX_FMT_MJPEG by default motion will use V4L2_PIX_FMT_MJPEG so
# set v4l2_palette 1 to force motion use V4L2_PIX_FMT_SBGGR8 instead. 
#
# Values :
#
# V4L2_PIX_FMT_SN9C10X : 0  'S910'
# V4L2_PIX_FMT_SBGGR8  : 1  'BA81'
# V4L2_PIX_FMT_MJPEG   : 2  'MJPEG'
# V4L2_PIX_FMT_JPEG    : 3  'JPEG'
# V4L2_PIX_FMT_RGB24   : 4  'RGB3'
# V4L2_PIX_FMT_UYVY    : 5  'UYVY'
# V4L2_PIX_FMT_YUYV    : 6  'YUYV'
# V4L2_PIX_FMT_YUV422P : 7  '422P'
# V4L2_PIX_FMT_YUV420  : 8  'YU12'
v4l2_palette 2
[...]

The rotation works well, and I'm not really interested in using the MJPEG as long as YUYV works fine too.

-- WaldemarSpomer - 25 Jul 2008

Answer

Good ! ok then i close this as a answered , i saw why is not working v4l2_palette ... order of palettes is in reverse mode , so i will close as a bug.

-- AngelCarpintero - 25 Jul 2008
Topic attachments
I Attachment Action Size Date Who Comment
motion.conf_toshibaconf_toshiba motion.conf_toshiba manage 23 K 25 Jul 2008 - 16:53 UnknownUser This is the motion.conf of the toshibalaptop, where rotation doesn't work.
Topic revision: r9 - 25 Jul 2008, AngelCarpintero
Copyright © 1999-2019 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.