From: Kenneth L. <ke...@la...> - 2005-08-25 08:24:46
|
>I've been playing with it more today. The problem I had yesterday was >that it was actually saving >files that were duplicates. I don't know why - I was getting about five >frames per second, but >two or three of them at a time would be duplicates. I would expect motion >to recognize the >duplicate (like you say it does), and ignore it and wait until the next >frame is available. > >After your reply I turned on debugging and watched it give me the >"vid_return_code 6" message >between every frame. But it's not saving the duplicate images anymore, >and I can't *make* it do >it any more either. If I slow the camera waaaaay down to 1000 ms exposure >times (one frame per >second), then motion just waits with the "vid_return_code 6" until the >next frame is delivered. >Just like I'd expect it to. > >I played with the image size vs. framerate and found that motion gets >about five fps with 250k >frames at 2048x1536. So I'm leaving it at that for now. The computer and >camera are connected >via one Cisco 3600 at full duplex / 100mbit, so I can't imagine I could >get the LAN speed any >higher. Motion 3.2.3 has the following feature. JPEG Netcams - Motion tries to fetch an image once every 1/framerate seconds. - When the netcam fails to deliver an image - motion simply copies the previous image to fill in and maintain the framerate. This gives the duplicate images. - If the netcam fails for 30 seconds the duplicate images are replaced by a grey image with an error message MJPEG - Here the netcam sets the pace. Motion receives pictures at the rate the camera decides (and has been set up for). - If Motion is set for a framerate lower than the camera it throw away some of the images. - If Motion is set for a framerate higher than the camera it adds duplicate images. - If the netcam fails for 30 seconds the duplicate images are replaced by a grey image with an error message Now obviously this duplicate image thing may not be 100% smart. So in the next version we try to be more flexible. There is one requirement. We MUST run through the motion main loop once per second and better twice per second. Otherwise certain services such as allowing webcams to connect and maintain the webcam stream will not work. The current two ideas we work with are. JPEG - Motion fetches an image once every 1/framerate - If the camera is slow Motion will WAIT a limited period. - If the period times out Motion will add a copy of the previous image. So only duplicate images when the Netcam gets really slow or disconnected. - If the netcam fails for 30 seconds the duplicate images are replaced by a grey image with an error message MJPEG - Here the netcam sets the pace. Motion receives pictures at the rate the camera decides (and has been set up for). - If Motion is set for a framerate lower than the camera it throw away some of the images. - If Motion is set for a framerate higher than the camera it will wait a certain limited period for the next image to arrive. The arrival of an image will reset the loop timer so that Motion will not try and catch up but just timeshift a little each time it waits. The result is that Motion in reality runs at the framerate of the network camera. - If the netcam fails for 30 seconds the duplicate images are replaced by a grey image with an error message The LIMITED period can be set to different values with different results. I have no plan to make it a configurable parameter. We have been discussing a 1/framerate period. This requires that the framerate of Motion is MAX 1 higher than the mjpeg stream. And it does not leave much time for a delay of a jpeg camera before duplicate images are added. But it does gove more images to feed to a movie file so it does not jump in speed. What I am thinking is better is a fixed 0.5 second timeout. It ensures that the webcam feature works and it makes Motion much easier to setup and will cause much less duplicate images. I think this is the best solution but I am open to oppinions. The code that does the above with 0.5 seconds is available in a daily snapshot. http://www.lavrsen.dk/sources/motion-daily/motion-20050825-101655.tar.gz I would like to hear feedback from Netcam owners on how it runs. Kenneth -- Kenneth Lavrsen, Glostrup, Denmark ke...@la... Home Page - http://www.lavrsen.dk |