Feature Request: optimize capture
Optimize capture with mmap read and writes
this can make capture from 10 fps to 30 fps!!!
like in palantir
- 02 May 2005
I do not understand your request. To my best knowledge Motion uses mmap and actually only supports mmap. The URL is too general for me to understand what you propose. Can you please be more specific?
- 02 May 2005
i was testing palantir server, and mmap from palantir can get 30 fps. with out mmap palantir get 10fps
today my motion server is getting 10 fps... so i think its not using mmap
understand the problem?
- 05 May 2005
What device did you test to get 30 fps ?
i've tested my LMLBT4 card , with motion i'm able to get around 25 f/s but with palantir only 10 f/s .
I realized that palantir "fakes" the f/s with pwc driver , from syslog i saw this :
pwc set_video_mode(320x240 @ 30, palette 15)
But was not true that was capturing 30 f/s most of captured frames were the same frame taken from the buffers.
- 06 May 2005
get this version first:
frame size is the same 320*240 NTSC COLOR (on AUTO changes fps to 10)
i'm using bttv (palatir version 2.5.6a!!!) , see:
[root@spd1: /etc/motion]# /usr/local/bin/palantir -C /etc/camera.1.conf -P 10
May 7 01:48:46 [main] -- palantir 2.5.6a starting --
May 7 01:48:46 [main] Definitions for 0 devices found
May 7 01:48:46 [main] No serial port specified
May 7 01:48:46 [main] No named pipe specified
May 7 01:48:46 [video] Card: BT878 video ( *** UNKNOWN/GENER (/dev/v4l/video0)
May 7 01:48:46 [video] Capabilities: 171 (capture tuner overlay clipping scales )
May 7 01:48:46 [video] Size: (48x32)-(768x480)
May 7 01:48:46 [video] Channel no. 0 ('Television') tuners: 1, flags: 3, type: 1, norm: 1
May 7 01:48:46 [video] Channel no. 1 ('Composite1') tuners: 0, flags: 2, type: 2, norm: 1
May 7 01:48:46 [video] Channel no. 2 ('S-Video') tuners: 0, flags: 2, type: 2, norm: 1
May 7 01:48:46 [video] Channel no. 3 ('Composite3') tuners: 0, flags: 2, type: 2, norm: 1
May 7 01:48:46 [video] brightness: 32768 hue: 32768 colour: 32768
May 7 01:48:46 [video] contrast: 32768 whiteness: 0
May 7 01:48:46 [video] depth: (24) palette: 4
May 7 01:48:46 [video] Actual capture box is 320x240 (requested 320x240)
May 7 01:48:46 [video] Video buffer size: 17039360, frames: 8
May 7 01:48:46 [main] *** Running a 10-second performance test
May 7 01:48:46 [main] Capture thread started
May 7 01:48:56 [main] Capture thread stopped - 298 frames in 10.01 s (29.77 f/s)
- 07 May 2005
Motion uses mmap and can capture 30 fps from a bttv (BT878) if the CPU is not too loaded or you have an old computer.
If you have more than one camera on a 4 input card with one chip framerate drops.
I do not understand the issue you have.
- 11 May 2005
maybe palantir can get only one camera and get more fps doing it
but seeting motion to only one thread and grabbing from the card i get ~16fps
- 12 May 2005
I have rejected the request because it seems this is more a support request so we can continue the topic with the scope of trying to find out WHY you cannot get a higher framerate.
Please do two things.
- Tell us more about your hardware. CPU, Speed, RAM, OS, Version of driver, capture card, camera
- Attach your motion.conf to this topic. Remember to alter secret passwords.
- 12 May 2005
i sent configuration as files
- 13 May 2005
First a comment: It is much easier to main and change things if you have all the settings in motion.conf and only the options that are different in the thread files. But this is not your problem.
I assume your low fraterate is with the settings you have sent. Ie. with all 4 camera threads running.
You have a video capture card with ONE BT878 chip. This chip can capture 30 frames per second in NTSC mode. The CHIP can capture at this rate. The chip has 4 inputs and it multiplexes between them. The BT878 only has ONE A/D. It cannot capture at 30 fps in parallel.
When you setup Motion to use the same video device with different input number Motion runs in Round Robin
This means that each time a new camera thread access the hardware it changes the MUX input and capture a frame.
So in theory you can get a framerate of 30/4=7.5 fps. However this is only true if you have cameras that are syncronized. In the real world the BT878 needs to resync to a new camera and this takes time and you probably have to throw away some frames ( [[ConfigOptionRoundrobinSkip][roundrobin_skip] ) so the real framerate becomes 2-5 with 4 cameras.
If you want 30 fps you need either 4 capture cards or one of the expensive cards with 4 BT878 chips. Such a card presents itself as 4 independent video devices all running at input 0. Often such cards has 8 inputs so that you can run 2 cameras in round robin at 10 fps or so per input.
Note that even if no camera is connected to an input but activated in Motion (there is a thread file loaded) the card changes input and captures no signal and this takes time.
You run at an extremely high resolution. Check out the spec of your cameras. Do they have this high resolution? Make sure you capture the native resolution of your camera. Unless it makes progressive scan (and not interlaced) you will want to run at the resolution of the chip so that you not get interlaced images. Interlacing on images looks awful when something moves in the picture and nothing can really repair this.
- 13 May 2005