motion video record and video from live http server jump up and down
Question
Good day. Sorry for bad english. I'm meet with some problem: Why i get a video in record and from live http server jumping alittle up and down? This is very annoying. We have a several 16-channelling card, 4 chip - bt878. we are running it on different settings as (bttv card=105,105,105,105 tuner=4,4,4,4 gbuffers=32)(well actually we tested almost all cards in bttv list and stopped on card number 105 and 77 and 71).There is a link to file where you can see these jumpings
http://webfile.ru/3928569 . Sometimes these jumpings repeat very often: two or three times per second. I also disabled other thread but this dont helped. So i stoppped only on two thread on one chip. Also i'm trying run motion with some other bt878 cards(one chip and four input on it)(we tested on four on them) and also get this small jumping up and down in video in records(avi) and through browser(live http server). 18.09.2009 I'm think that is problem of roundrobin, because when i set only two input per chip - then pictures is stable. And when i'm using four inputs per chip and set roundrobin_frames = 2 and roundrobin_skip=2 then pictures jumping lesser, but jumping! And motion very slow and people moving too fast almost as teleportation.
Environment
Motion version: |
3.2.9 |
ffmpeg version: |
r11872+debian_3:0.svn20080206-12ubuntu3.1 |
Libraries: |
ffmpeg |
Server OS: |
debian |
--
AlexeyChernopyatov - 17 Sep 2009
Answer
- Kill Motion Daemon... Now, do you experience same behavior in xawtv , tvtime or similar program ???...
- Please use the latest stable version of Motion (3.2.11.1) or latest svn trunk :
http://www.lavrsen.dk/foswiki/bin/view/Motion/MotionDailySourceSnap
- Please post your actual motion.conf after filter them with :
http://www.lavrsen.dk/foswiki/bin/view/Motion/SupportQuestion2009x04x12x141907
- Why use input 8 / usb camera, when you have card / analog camera ???...
- Take a look in your /var/log/messages logs about Motion loading...
- Read here :
http://www.lavrsen.dk/foswiki/bin/view/Motion/FrequentlyAskedQuestions#How_do_I_get_Motion_to_work_with
http://www.lavrsen.dk/foswiki/bin/view/Motion/FeatureRequest2005x05x02x210851
http://www.lavrsen.dk/foswiki/bin/view/Motion/SmoothVideoFromEventStartToStop
--
FlorinAnton - 18 Sep 2009
19 Sep 2009
To
FlorinAnton: I'm added my actual motion.conf without comments as you asked. Well as i said early "18.09.2009 I'm think that is problem of roundrobin, because when i set only two input per chip - then pictures is stable. And when i'm using four inputs per chip and set roundrobin_frames = 2 and roundrobin_skip=2 then pictures jumping lesser, but jumping! And motion very slow and people moving too fast almost as teleportation." And of course i dont have that problem in xawtv and mplayer because they can display only video from one input on chip. And that video run without jumping , but when i'm using one input per chip or even two - jumping also dont occur, but when i'm get video from three or from all input in chip - pictures and video starting jumping. I'm include some images in attachment so you can see that. About daemon, i'm often running motion without daemon, simply running motion -n, and this dont make any different, but i can see some debug info.
Why use input 8 / usb camera, when you have card / analog camera ???...
Answer: Because these input overwritings in threads config for each camera, so i'dont see what for i must change input in main.conf when i'm write configs for each input on chips.
Take a look in your /var/log/messages logs about Motion loading...
Answer: Motion loading just fine, i can restart motion and show you part of log messages about motion loading. All working but pictures and video jumping alittle up and down, when i'm using 3 or 4 input per chip, with one camera on chip or even with two all fine.
- config.zip: Motion main config and threads configs
- jumping_images.zip: i make some snapshot - on these pictures clearly see - video alittle jumping up and down
- My personal opinions are :
- Seems that "syncronization" is your problem, read here :
http://www.lavrsen.dk/foswiki/bin/view/Motion/FeatureRequest2005x05x02x210851 and here :
http://www.lavrsen.dk/foswiki/bin/view/Motion/SupportQuestion2004x11x09x194756 and decrease your framerate from 50 fps to 7 fps... Motion with 16 cameras each at 50 fps => your CPU is working at 100% all the time... check with top command.
- FLV encoding can be made reading here :
http://www.lavrsen.dk/foswiki/bin/view/Motion/SupportQuestion2008x10x21x165451
- Motion only records frames to the mpeg when motion is detected unless you tell it to fill up using the post_capture feature AND not using high values for pre_capture ; enable locate on in motion.conf to see the detected motion.
- If you want smooth videos like this :
http://xanview.com/Demo , you must use the latest svn trunk version of Motion and apply some patches (
http://www.lavrsen.dk/foswiki/bin/view/Motion/MotionPatches) or wait until Motion version 4.x. is released...
- Note that round robin is not the ideal way to run multiple cameras. When the capture card changes input it takes a little while before the decoder chip has syncronized to the new camera. You can improve this if you have expensive cameras with a syncronize input. Only one camera can be decoded at a time so if you have 4 cameras connected 3 of the camera threads will need to wait for their turn. The fact that cameras have to take turns and the fact that you have to skip a few frames after each turn dramatically lowers the possible framerate. You can get a high framerate by viewing each camera for a long time. But then you may miss the action on one of the inactive cameras. If you can afford it avoid Round Robin and buy the more expensive type of capture cards that has one decoder chip per input. If you only need 2 or 3 cameras you can also simply put 2 or 3 cheap TV cards in the computer. Linux has no problem working with multiple TV cards.
If multiple threads use the same video device, they each can capture roundrobin_frames number of frames before having to share the device with the other threads. When another thread wants to watch another input or frequency or size the first roundrobin_skip number of frames are skipped to allow the device to settle. The last option switch_filter is supposed to prevent the change of camera from being detected as Motion. Its function is not perfect and sometimes prevents detection of real motion. You should start with having the option disabled and then try with the option enabled to see if you can skip less frames without loosing the detection of the type of motion you normally want to detect.
--
FlorinAnton - 19 Sep 2009
20 Sep 2009
"decrease your framerate from 50 fps to 7 fps" physically chips cant give more frames then it can. Values framerate 50 or ...more then can give chip you dont get it. Wemany times changed these values and result stay same. Sending as on buying expensive device where one input per chip uncorrect. We have alot cards where four inputs per chip and we want get stable pictures throught our Gigabit LAN, but we get jumping pictures, CPU working when all 16 camers working is
top - 12:30:23 up 2 days, 21:02, 1 user, load average: 1.17, 0.74, 0.53
Tasks: 46 total, 2 running, 44 sleeping, 0 stopped, 0 zombie
Cpu(s): 40.7%us, 0.7%sy, 0.0%ni, 57.7%id, 0.0%wa, 0.3%hi, 0.7%si, 0.0%st
Mem: 507776k total, 501648k used, 6128k free, 21288k buffers
Swap: 497972k total, 696k used, 497276k free, 414424k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
3800 motion 20 0 200m 41m 2996 S 50.3 8.4 3:14.60 motion
3819 root 20 0 2392 1088 884 R 0.7 0.2 0:00.02 top
Increasing of memory dont give a stable picture we tried it.
You send us to patches - well we get normal smooth video, but frames also jumping alittle, but moving of objects are smooth, we thinking what when motion changing channel on thep chip, motion cant get stable pictures. When we using one or two inputs on chip all OK! But we loose a count of possible camers which we can use on one server! We asked can we solve this problem in motion or not? P.S. Don't take us for an idiots. We spending alot time with motion and all kind of problems - all resolved beside jumping up and down video.
- Maintenance and Support :
- Both Motion and the Motion Guide are written by people that do all this as a hobby and without asking for any payments or donations. We have a life other than developing Motion and its documentation. This means that bugfixes and updates to this guide are done as our time and families allow it. You are however encouraged to participate and contribute in a very active mailing list. It is a list with a very "positive attitude" and with many contributors that propose features, post patches, discuss problems and patiently answer newbie questions with a very positive spirit. Expect 1-10 emails per day.
- For support we encourage you to join the mailing list instead of writing to Jeroen, Folkert or Kenneth directly. We are all very active on the mailing list and by using the mailing list much more users will have benefit of the answers. Newbies and stupid questions are welcome on the list. Contributions in the form of patches are also very welcome on the mailing list.
- P.S. : We still believe you are not idiots... Please respect other's opinions and try to not pollute this wiki...
--
FlorinAnton - 20 Sep 2009
Sep 21 2009
Still we have a question - this problem is solved with help of motion? For example can we corect this problem if looking in motion source and rewrite some procedure(we stiil dont looking inside, but we think that we can handle with this). Or we must solve this problem with help other devices - such as other programs or ... But we hope that we can solve this proble with help moton. Because dont all have a net cams. Faithfully yours, Alexey.
Oct 16 2009
Good day. We solved our problem. But for this we had give up on using motion. So we just write our C++ code(of cource we created our little simple classes). So problem with jump and down - was int getting pictures from devices with help ioctl(), so we used v4l2_cropcap and v4l2_crop and v4l2_format structures for little croping from up and down and scaled it on needed size - so pictures already fine and speed alot fasten and smoothly than motion, but of course we also write ours sockets for streaming and controling v4l2 devices. But, out of pity we cant used a motion source code - because it badly structured and redundant. Faithfully yours, Alexey.