BUG: Problem using 2 cameras with 1 capture card
I am using 2 cameras connected to 1 Video Capture Device with 4 inputs (/dev/video0).
I have 2 thread.conf files and 1 motion.conf. They are configured correct.
But when i start motion and it starts to capture video in mpeg4, in the first video there are frames from the second.. They are mixed. Maybe there is a problem switching cameras.
I tried to changed the inputs, but nothing...
Test case
thread1.conf:
videodevice /dev/video0
input 0
target_dir /cameras/cam1
...
thread2.conf - input 1
videodevice /dev/video0
input 1
target_dir /cameras/cam2
...
The cameras works a short time
.
I starts /cameras/cam1/....avi
And e.g. first n frames are correct, n+1 (or maybe AND n+1, AND n+2...) is from the second camera.
If there is no cammera attached to input 1, but there are 2 thread confs, it should not create .avi file in /cameras/cam2, because there is no motion (only a blue screen) and it DON'T, but there are blue frames (from the unplugged camera) in the first movie.
Environment
Motion version: |
3.2.6 from tar.gz |
ffmpeg version: |
0.4.9-0.lvn.0.20.20051228.4 |
Shared libraries: |
ffmpeg |
Server OS: |
Fecora Core 4, kernel 2.6.15-1.1833_FC |
--
StanchoBancho - 14 Apr 2006
Follow up
Fix record
This is not a bug. You have a capture card with one BT878 chip. It has a multiplexer that changes between the input. The chip can in fact only read from one camera at a time and when you have more than one camera the cameras share the 25 frames per second in PAL ot30 in NTSC.
Unless your cameras are perfectly synced the shift from camera to camera does not happen perfectly.
It is very likely that when you read the video frame from the capture card right after a change of input the picture you get belongs to the previous frame because the new frame is not loaded yet.
The mode of operation you run is what is called Round Robin.
Motion has a number of options to deal with the problem.
Read the Motion Guide section
CaptureDeviceOptions - especially the Round Robin section at the end. I just made some minor improvements to it.
--
KennethLavrsen - 14 Apr 2006