Thread numbering versus network camera assignments
Question
I have six network cameras with a lot of custom written scripts (bash, php, awk) which build various
http display pages showing motion events and snapshots by time of day per camera.
Problem is this:
When a camera fails (hardware failure), I needed to remove it to send back to manufacturer.
Motion does not start because of missing device. Therefore I removed thread definition for that bad camera from motion.conf. Motion starts OK now BUT the thread numbers are not what they used to be. If I removed the thread definition for "camera 2" and my scripts want to send a command or get an image from "camera 4", they send it to thread 4 (representing what was camera 4) when the
thread 4 is now acually "camera 5" (because camera 2 is missing).
HOW can I (temporarily until my broken hardware gets replaced) change the thread 2 config file to tell it to create thread 2 just like before when all was well and to continue the thread numbering like normal (with thread 3 assigned to my camera 3, thread 4 to cam 4, etc) without actually having it attempt to connect to a non-existing device. I need a way in a thread config file to indicate that the device does not exist, i.e. create a dummy thread which does nothing. The dummy thread should occupy the thread number (for example 2 representing the missing camera 2), but should not issue any errors about unable to retrieve image or bad frame header or unable to connect ot libjpeg decompression failure OR any of the other various error messages I've gotten from it when I've tried to define a "dummy thread".
The solution (I believe) is simple: If the netcam_url line says this:
http://0.0.0.0 then define the "dummy" thread (as if the url had been valid), BUT during motion processing do not attempt to open the image or create snapshots or detect any motion or anything for
that url. Just ignore it. Define the thread so that thread 3 is still for camera 3 and so that the thread/camera/ipaddress assignments remain as they originally were.
This would be a very important feature for me since I have had a rash of failed cameras and the situation seems to be getting worse.
Thank you
My attempt to define a dummy thread for camera 2 is as follows: I replaced the second "thread"
command in motion.conf with one that attempts to define a dummy device, config is this:
#
# deadthread.conf
#
text_left "CAMERA OFFLINE\nMotionSize: %ix%J\nMotionCenter: %K,%L\nPixels: %D"
webcam_port 8099
framerate 2
netcam_url http://127.0.0.1/images/security_not_operational.jpg
threshold 120000
This works (a dummy thread is created and motion starts and runs OK) except that this error
message occurs every 10 seconds (thus wasted cpu cycles and a full error log file):
Jun 29 07:57:40 cazzati motiond: [2] Retrying until successful initial connection with network camera
Jun 29 07:57:40 cazzati motiond: [2] libjpeg decompression failure on first frame - giving up!
Jun 29 07:57:50 cazzati motiond: [2] Retrying until successful initial connection with network camera
Jun 29 07:57:50 cazzati motiond: [2] libjpeg decompression failure on first frame - giving up!
Environment
Motion version: |
3.2.4 snap 5 |
ffmpeg version: |
none |
Libraries: |
none |
Server OS: |
Fedora Core 4 kernel 2.6.16-1.2115_FC4 |
--
GregSwift - 29 Jun 2006
Answer
You can simply activate Apache locally and put a static jpeg image on it with the right dimentions.
And use
netcam_url http://localhost/testimage.jpg
And set the framerate to 2.
And if you use the webcam stream feature people will see the testimage.jpg which can be a nice image saying that the camera is out of order.
Test image must be of the same dimentions as height and width in motion.conf.
--
KennethLavrsen - 29 Jun 2006
My reply to your reply ...
As you can see from the config I show above, that is exactly what I am doing.
The jpeg file referenced is correct and is a valid .jpg,
HOWEVER, why are those error messages coming out complaining about the jpg file ???
--
GregSwift
from the error messages it seems that Motion cannot see the jpeg image.
Maybe some firewall setting or URL is not correct? Is Apache running?
--
KennethLavrsen - 01 Jul 2006
KEN:
There is no firewall on this dedicated machine. URL is correct, apache is running,
jpg file exists and is valid. Is the message specifically issued because motion
thinks that it can not find the file, or is it because the found file is invalid?
What else should I try or check ?? Thanks. g.s.
KEN:
Updated info ... I fixed the problem. I took the jpg file I had referenced and even
though it was valid (was viewable by several image viewers) I changed it with
the "gimp" image editing program (not sure exactly HOW I changed it).
Anyway, by "fixing" the jpg, it works OK now. Thanks. g.s.