Motion - Support Question 2007x 01x 15x 230952

Only 2fps out of msmpeg4

Question

Using msmpeg4 cannot achieve more than 2fps in the motion video. Getting no error message apart from the one seen below. Is there something wrong with the ffmpeg? This is fairly strange, since the hardware is perfectly capable of doing video in far higher resolution than what is setup in motion in 12fps. This has only been tested with other tools than ffmpeg libraries, to have a view on how fast the HW is.

I'm quite interested in what the sync error means, since there isn't much documentation for the motion error messages. However I'm not really convinced it's related to the slow fps, since it's at least recording some video.

motion.conf : 

daemon on
quiet on
videodevice /dev/video0
input 0
width 384
height 288

framerate 12
quality 85
auto_brightness off

brightness 0
contrast 0
saturation 0
hue 0

ffmpeg_cap_new on
ffmpeg_video_codec msmpeg4
ffmpeg_timelapse 2
ffmpeg_timelapse_mode daily
#ffmpeg_bps 600
ffmpeg_deinterlace on


target_dir /survilance_video
movie_filename cam0/video/%Y-%m-%d/%Y-%m-%d-%T
timelapse_filename cam0/timelapse/%Y-%m-%d/%Y-%m-%d-%T
jpeg_filename cam0/images/%Y-%m-%d/%Y-%m-%d-%T

output_normal off
webcam_port 8080

# Set to 'off' to allow anybody (not just localhost) to view the
# webcam via the mini-http server (http://hostname:port)
webcam_localhost off

webcam_quality 50
webcam_maxrate 8

control_port 8081
control_localhost on
control_html_output on

# Authentication for the http based control. Syntax username:password
# Default: not defined (Disabled)
; control_authentication username:password

motion -s :
0] Processing thread 0 - config file /etc/motion/motion.conf
[0] Motion running in setup mode.
[0] Thread 1 is from /etc/motion/motion.conf
[0] Thread 1 is device: /dev/video0 input 0
[0] Waiting for threads to finish, pid: 5331
[1] Thread started
[0] motion-httpd/3.2.7 running, accepting connections
[0] motion-httpd: waiting for data on port TCP 8081
[1] sync error in proc 5331: Input/output error
[1] Started stream webcam server in port 8080
[1] sync error in proc 5331: Input/output error
[1] Changes:     0 - noise level: 29
[1] File of type 32 saved to: /survilance_video/cam0/timelapse/2007-01-16/2007-01-16-00:14:31.mpg
[1] sync error in proc 5331: Input/output error
[1] Changes:     0 - noise level: 29
[1] sync error in proc 5331: Input/output error
[1] Changes:     0 - noise level: 26
[1] sync error in proc 5331: Input/output error
[1] Changes:     0 - noise level: 26
[1] sync error in proc 5331: Input/output error
[1] Changes:     0 - noise level: 41
[1] sync error in proc 5331: Input/output error
[1] Changes:     0 - noise level: 41
[1] sync error in proc 5331: Input/output error
[1] Changes:     0 - noise level: 42
[1] sync error in proc 5331: Input/output error
[1] Changes:     0 - noise level: 42
[1] sync error in proc 5331: Input/output error
[1] File of type 8 saved to: /survilance_video/cam0/video/2007-01-16/2007-01-16-00:14:35.avi
[1] Motion detected - starting event 1
[1] Changes:  4411 - noise level: 42
[1] sync error in proc 5331: Input/output error
[1] Changes:  6415 - noise level: 42
[1] sync error in proc 5331: Input/output error
[1] Changes:  3497 - noise level: 42
[1] sync error in proc 5331: Input/output error

lspci -v:

00:08.0 Multimedia controller: Philips Semiconductors SAA7130 Video Broadcast Decoder (rev 01)
        Subsystem: Avermedia Technologies Inc AVerMedia DVD EZMaker
        Flags: bus master, medium devsel, latency 32, IRQ 193
        Memory at f6000000 (32-bit, non-prefetchable) [size=1K]
        Capabilities: [40] Power Management version 1

ffmpeg -version :
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)
ffmpeg      SVN-rUNKNOWN
libavutil   3211264
libavcodec  3345152
libavformat 3278080

Environment

Motion version: 3.2.7
ffmpeg version: see above
Libraries: ffmpeg, libmysqlclient
Server OS: kubuntu edgy, kernel 2.6.17-10-generic

-- PavelTaboracek - 15 Jan 2007

Answer

Well the sync error in proc 5331: Input/output error is not something normal

It seems there is a problem with the driver and Motion working together.

Do you run an USB camera? And does it have a USB controller by itself?

-- KennethLavrsen - 15 Jan 2007

Nope, I'm running AVerMedia DVD EZMaker in PCI slot and having an old SVHS video camera connected through the composite input. It all goes through the v4l2 driver. I'm rather wondering about the low fps than the input/output error, but that still might be related.

The bad news about me doing something horribly wrong came to my mind, when google did not come up with anything but 2 yrs old unaswered support question on this site.

Anyway, thank you for your help.

-- PavelTaboracek - 15 Jan 2007

Please give a try to svn version of motion that has an experimental support for V4L2.

btw to set in motion.conf setup_mode off to get a normal image in webcam stream.

-- AngelCarpintero - 16 Jan 2007

Okay, compiled the svn version (3.2.8). That fails to capture any images... if this helps for future development, here is the output from motion -s. I'm going to return to 3.2.7 and 2fps and looking forward for the next stable version.

btw > motion.conf has not been changed from the previous version...

[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/video0 input 0
[0] Waiting for threads to finish, pid: 12041
[1] Thread started
[1] cap.driver: "saa7134"
[1] cap.card: "AVerMedia DVD EZMaker"
[1] cap.bus_info: "PCI:0000:00:08.0"
[1] cap.capabilities=0x05000015
[1] - VIDEO_CAPTURE
[1] - VIDEO_OVERLAY
[1] - VBI_CAPTURE
[1] - READWRITE
[1] - STREAMING
[1] v4l2_select_input: name = "Composite1", type 0x00000002, status 00000000
[1] - CAMERA
[1] Supported palettes:
[1] 0: GREY (8 bpp gray)
[1] 1: RGBO (15 bpp RGB, le)
[1] 2: RGBQ (15 bpp RGB, be)
[1] 3: RGBP (16 bpp RGB, le)
[1] 4: RGBR (16 bpp RGB, be)
[1] 5: BGR3 (24 bpp RGB, le)
[1] 6: RGB3 (24 bpp RGB, be)
[1] 7: BGR4 (32 bpp RGB, le)
[1] 8: RGB4 (32 bpp RGB, be)
[1] 9: YUYV (4:2:2 packed, YUYV)
[1] 10: UYVY (4:2:2 packed, UYVY)
[1] 11: 422P (4:2:2 planar, Y-Cb-Cr)
[1] 12: YU12 (4:2:0 planar, Y-Cb-Cr)
[1] 13: YV12 (4:2:0 planar, Y-Cb-Cr)
[1] Using palette YU12 (384x288)
[1] found control 0x00980900, "Brightness", range 0,255
[1]     "Brightness", default 128, current 128
[1] found control 0x00980901, "Contrast", range 0,127
[1]     "Contrast", default 68, current 68
[1] found control 0x00980902, "Saturation", range 0,127
[1]     "Saturation", default 64, current 64
[1] found control 0x00980903, "Hue", range -128,127
[1]     "Hue", default 0, current 0
[1] found control 0x00000000, "42", range 0,0 !DISABLED!
[1]     "42", default 0, current 0
[1] found control 0x00000000, "42", range 0,0 !DISABLED!
[1]     "42", default 0, current 0
[1] found control 0x00000000, "42", range 0,0 !DISABLED!
[1]     "42", default 0, current 0
[1] found control 0x00000000, "42", range 0,0 !DISABLED!
[1]     "42", default 0, current 0
[1] found control 0x00000000, "42", range 0,0 !DISABLED!
[1]     "42", default 0, current 0
[1] found control 0x08000000, "Invert", range 0,1
[1]     "Invert", default 0, current 0
[1] found control 0x08000001, "y offset odd field", range 0,128
[1]     "y offset odd field", default 0, current 0
[1] mmap information:
[1] frames=2
[1] 0 length=167936
[1] 1 length=167936
[1] Using V4L2
[0] motion-httpd/3.2.8 running, accepting connections
[0] motion-httpd: waiting for data on port TCP 8081
[1] v4l2_next: VIDIOC_DQBUF: Input/output error
[1] v4l2_next: VIDIOC_DQBUF: Input/output error
[1] v4l2_next: VIDIOC_DQBUF: Invalid argument
[1] v4l2_next: VIDIOC_DQBUF: Invalid argument
[1] v4l2_next: VIDIOC_DQBUF: Invalid argument
[1] v4l2_next: VIDIOC_DQBUF: Invalid argument
[1] v4l2_next: VIDIOC_DQBUF: Invalid argument
[1] v4l2_next: VIDIOC_DQBUF: Invalid argument
[1] v4l2_next: VIDIOC_DQBUF: Invalid argument
[1] v4l2_next: VIDIOC_DQBUF: Invalid argument
[1] Error capturing first image
[1] Thread finishing...

-- PavelTaboracek - 16 Jan 2007

Ok thanks , now i have a lot information that will help me to solve your problem and for people that uses your capture card.

FYi i've something the problem comes from linux/drivers/media/video/video-buf.c in function videobuf_dqbuf :

switch (buf->state) {
        case STATE_ERROR:
                dprintk(1,"dqbuf: state is error\n");
                retval = -EIO;   <-- is Input/output error
                videobuf_dma_sync(q,&buf->dma);
                buf->state = STATE_IDLE;
                break;

and

if (q->reading) {
                dprintk(1,"dqbuf: Reading running...\n");
                goto done;
        }
        retval = -EINVAL; <--- Invalid argument

Seems that the -EIO is because the buffer is not filled yet , quotting V4L2 specs :

"VIDIOC_DQBUF failed due to an internal error. Can also indicate temporary problems like signal loss. Note the driver might dequeue an (empty) buffer despite returning an error, or even stop capturing".

So maybe there's a problem of timming in motion implementation of V4L2 ... i'll see

BTW : Did you get that kind of message from others programs live xawtv and so on ? , because maybe i'm thinking that problem could be the way to load the driver from your camera , i think is something like :

modprobe bttv
modprobe saa7134 card=33

I'm guessing that you have a real AVerMedia DVD EZMaker ( 1461:10ff ).

-- AngelCarpintero - 16 Jan 2007

Well, I didn't get any error from XawTV, but camstream is basically complaining about the same as motion (error -5 input/output error). The programing stuff unfortunately doesn't mean much to me:(

Anyway, I have the real AVerMedia DVD EZMaker, it's not anything rebranded, if you mean this.

So for the solution, I'll go trying the bttv driver instead of the v4l2 and will see.

btw > I've been looking around for the v4l2, it actually allows one to force the v4l1 api (v4l-conf -1). Is there a way how to force motion to use this feature? At least for some test...

-- PavelTaboracek - 16 Jan 2007

okay, taking back the bttv phrase. It's saa713X branch card, therefore not supported under bttv...

And btw the card has been autodetected by the kernel I'm using. I'm still thinking about replacing the v4l2 for v4l1...

-- PavelTaboracek - 16 Jan 2007

Could you help me to figure out what can be your problem ?

remove the driver :

 rmmod saa7134

Load the driver (not sure if you need to use also tuner parameter , could be) :

 modprobe saa7134 card=33

Paste the output of dmesg and lspci -vv , because i'm sure we are forgetting some detail.

Thanks.

-- AngelCarpintero - 17 Jan 2007

I've just taken the PC to my customer:( However, I'll be there tommorow anyway, so I'll try and will paste the output.

-- PavelTaboracek - 17 Jan 2007

Sorry for such a long time no response. Ive removed and placed the kernel module back. However, there is no luck anyway. I'll put the lspci output as soon as I hook up the machine back to the internet.

-- PavelTaboracek - 22 Jan 2007

Is there a follow up on this one? I'm suffering from the same effect: 1 - 2 fps allthough framerate is 25 and xawtv is smooth as a real monitor on 4 channels in parallel. Using a bttv card with 8 processors mapping dev/video0 - 7 in the system. No error messages, just slow captuirng. Thanks for any help

-- AxelAmthor - 01 Mar 2007

I think there is something wrong with Motion's initialization for V4L2. In order to get my bttv card to work, I have to run tvtime for each video device Motion will use before starting Motion. Otherwise, I get errors similar to above.

-- AndrewHamilton - 01 Mar 2007


Please try with motion 3.2.10.1 and reopen if problem remains , anyway not all capture cards has this issue .

-- AngelCarpintero - 16 Jun 2008
Topic revision: r14 - 16 Jun 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.