Motion - Support Question 2006x 12x 10x 111707

minimum_frame_time not working as expected...

Question

Hi everybody,

I am now using motion (3.2.7, the .deb package) with my TerraTec WinTV+ to monitor a bird's nestbox which has a built-in IR camera.

Great piece of software!

I recently upgraded from an older version to 3.2.7.

These days, "my" bird (a blue tit) spends every other night in the box, so whenever the bird moves during the night, a picture is taken and archived as .jpg file.

Therefore, I have to limit the number of pictures taken, so my hard drive does not get filled up.

I am trying to use minimum_frame_time 30 to ensure that pictures are never taken and saved to the hard drive more frequently than every 30 seconds.

That seems to work OK, but with that option enabled, the web cam picture is only updated every 30 seconds, too! The web browser, when being pointed at the web cam page, fetches a new picture every second or so, but it only changes every 30 sec.

According to the doc in the wiki, the http web cam picture should be updated at the pace of the "framerate" setting. Instead, it is being updated at the minimum_frame_time interval , which is not what I would expect.

Whether I set framerate to 2 or 10 does not make any difference.

Am I missing something here, or is that a bug?

Any help is appreciated.

http://sued40.dyndns.org/meisencam/

Regards Philipp


My config:

# daemon = on
# process_id_file = (not defined)
# setup_mode = off
# videodevice = /dev/video0
# input = 1
# norm = 0
# frequency = 0
# rotate = 0
# width = 768
# height = 576
# framerate = 10
# minimum_frame_time = 30
# netcam_url = (not defined)
# netcam_userpass = (not defined)
# netcam_proxy = (not defined)
# auto_brightness = off
# brightness = 110
# contrast = 0
# saturation = 0
# hue = 0
# roundrobin_frames = 1
# roundrobin_skip = 1
# switchfilter = off
# threshold = 8000
# threshold_tune = off
# noise_level = 32
# noise_tune = on
# night_compensate = off
# despeckle = (not defined)
# mask_file = (not defined)
# smart_mask_speed = 0
# lightswitch = 0
# minimum_motion_frames = 1
# pre_capture = 0
# post_capture = 0
# gap = 60
# max_mpeg_time = 180
# low_cpu = 0
# output_all = off
# output_normal = on
# output_motion = off
# quality = 50
# ppm = off
# ffmpeg_cap_new = off
# ffmpeg_cap_motion = off
# ffmpeg_timelapse = 0
# ffmpeg_timelapse_mode = manual
# ffmpeg_bps = 400000
# ffmpeg_variable_bitrate = 0
# ffmpeg_video_codec = mpeg4
# ffmpeg_deinterlace = off
# snapshot_interval = 0
# locate = off
# text_right = %d.%m.%Y\n%H:%M:%S
# text_left = (not defined)
# text_changes = on
# text_event = %Y%m%d%H%M%S
# text_double = off
# target_dir = /var/www/motion/neue_bilder/
# snapshot_filename = %v-%Y%m%d%H%M%S-snapshot
# jpeg_filename = %v-%Y%m%d%H%M%S-%q
# movie_filename = %v-%Y%m%d%H%M%S
# timelapse_filename = %Y%m%d-timelapse
# webcam_port = 8000
# webcam_quality = 60
# webcam_motion = off
# webcam_maxrate = 1
# webcam_localhost = off
# webcam_limit = 0
# control_port = 999
# control_localhost = off
# control_html_output = on
# control_authentication = birdy:test
# track_type = 0
# track_auto = off
# track_port = (not defined)
# track_motorx = 0
# track_motory = 0
# track_maxx = 0
# track_maxy = 0
# track_iomojo_id = 0
# track_step_angle_x = 10
# track_step_angle_y = 10
# track_move_wait = 10
# track_speed = 255
# track_stepsize = 40
# quiet = on
# on_event_start = (not defined)
# on_event_end = (not defined)
# on_picture_save = (not defined)
# on_motion_detected = (not defined)
# on_movie_start = (not defined)
# on_movie_end = (not defined)
# sql_log_image = on
# sql_log_snapshot = on
# sql_log_mpeg = off
# sql_log_timelapse = off
# sql_query = sql_query insert into security(camera, filename, frame, file_type, time_stamp, event_time_stamp) values('%t', '%f', '%q', '%n', '%Y-%m-%d %T', '%C')
# mysql_db = (not defined)
# mysql_host = (not defined)
# mysql_user = (not defined)
# mysql_password = (not defined)
# video_pipe = (not defined)
# motion_video_pipe = (not defined)
# thread = No threads

Environment

Motion version: 3.2.7
ffmpeg version:  
Libraries: ffmpeg, mysql, postgresql
Server OS: Debian Sarge, Kernel 2.6.8

-- PhilippHaeuser - 10 Dec 2006

Answer

When you set enabled this parameter , motion takes a picture at the value interval. So http webcam shows the same image until a new one is taken.

That feature was introduced to allow people using network cameras to avoid waste bandwidth.

There's no bug , it's the correct behaviour.

-- AngelCarpintero - 10 Dec 2006

Question

Ah, I see! I just interpreted this function wrong.

But how can I get motion to both

a) show a real-time picture every second when someone visits the motion http port

b) save a picture to disk when there is motion, but no more often than one picture every 30 seconds (to save disk space)

?

-- PhilippHaeuser - 10 Dec 2006

a) No , at least using motion built-in features. It could be a future feature adding a on_web_connect/on_web_disconnect events and then trigger a external event, i.ex a script that sends some request to http web interface to change the motion parameters like : framerate , minimum_frame_time , etc ... But right now you can emulate this feature using a proxy that allows connect/disconnect events, maybe a perl daemon or a php, python, etc script can do the trick.

b) Same as above ... but easier to find a way because you have the on_event_start / gap and on_picture_saved so you can decide with a script when a image should be stored or removed in time from previous one is too short.

-- AngelCarpintero - 11 Dec 2006

Can't you just put the minimum_gap option in again? This would be the solution. The versions before 3.2.7, they had minimum_gap , and a) and b) was no problem. For me, minimum_gap was NOT useless. And I do not want to downgrade, if possible.

-- PhilippHaeuser - 11 Dec 2006

Let me talk with Kenneth about it.

-- AngelCarpintero - 11 Dec 2006

If we introduce it then for sure we give it another name because people always mixed up minimum_gap and gap.

But first let us setup the user cases and make sure we make the right feature combination so things work properly afterwards.

I also have a camera in a bird box. And I can tell you that you do not get the right kind of pictures by saving only one picture per 30 seconds.

You should perhaps consider some different approaches.

  • You need to send frames to a web camera at least when you connect. Otherwise the browser times out. The webcam feature can be set up so that frames are only sent when Motion is detected.
  • To detect when things are moving you need to sample pretty often. Two frames per second is not too bad.
  • You can define a relatively short gap (period of no movement that times out an event). And then set output_normal to best. What happens then is within each event it saves the picture with the most Motion detected. This is normally also the most interesting picture. This way you do not get that many pictures. With the old minimum_gap feature Motion would save what in reality was often pretty boring pictures and you would most often miss the best action pictures. I had extremely poor experience with this feature compared to output_normal best. If you choose output_normal first then you get a picture of the dark shadow when the parent birds fly through the hole and that is no fun either.
  • If you still only want rare pictures and you want more than one picture stored within one event then you can easily make max one picture per minute by simple using a jpeg_filename like %Y%m%d%H%M. Note no seconds. Then Motion simple overwrites to the same filename within one minute and you end up with a similar result as if you had minimum_gap set to 60 seconds.
  • To avoid saving when the bird just moves a little bit, you can define minimum_motion_frames to e.g. 10. With a framerate of 2 the bird has to move for more than 5 seconds to cause pictures to be saved. But if it does move for this long ALL the pictures will be saved. This means many pictures when it is fun (bird babies being fed) and none when the bird moves a little while it sleeps. And they do move a lot during the night wink
  • Finally you can use a script run by on_picture_save to run a script that deleted picture. An idea can be that this script deleted pictures older than one day or delete the oldest of 200 pictures. I have such a script that deletes when I have more than a certain number of pictures. I set the value so I have 1-2 days. And then I look at the pictures each day and save the best in another directory. That is what I did when my Great Tits had babies.

-- KennethLavrsen

Kenneth - Thanks a lot for your your reply! It turned out I had misinterpreted some of the options I used, and with others I now finally know how they are really meant to be used. Your few lines here would do good as a tutorial, maybe in a new annotated "config examples" section? That would be good for newbies....

There is one problem I have found in my setup: My camera/framegrabber does not handle quick motion so well - if the bird moves quickly while the picture is taken, the pictures get a bit blurred. By always saving the pictures with most motion (output_normal = best), a substantial portion of the pictures are affected by this blurring.

But still, this is much better than it was, and I never again get any useless pictures that are just showing the bird's head or tail on entering or leaving the box.

-- PhilippHaeuser - 13 Dec 2006
Topic revision: r10 - 16 Jan 2007, AngelCarpintero
Copyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Please do not email Kenneth for support questions (read why). Use the Support Requests page or join the Mailing List.
This website only use harmless session cookies. See Cookie Policy for details. By using this website you accept the use of these cookies.