Motion - Support Question 2006x 06x 19x 000617

Motion captured in one camera, but not the other, in a two-camera setup

Question

I have motion_3.2.6-2_i386 running under Debian 1:3.3.5-13 (Linux version 2.4.27-3-k7, unmodified) and using the latest versions of ffmpeg, myssql, and postgresql. The PC has a 4-input PCI capture card, with X-10 cameras attached to the first two inputs only.

When I first started setting this system up, everything seemed to be working OK, until I started customizing some of the settings. I just changed some of the simple ones, like motion capture filename. Now, one camera works pretty much as it should (most of the time), and the other never captures any motion. They both will stream video fine, and they both take an hourly snapshot fine, but the event variable never changes on camera 2. For example, the snapshot filename I am using for camera 2 is "drivecamsnap%v", but every time it winds up as file "drivecamsnap01.jpg". Camera 1 increments like it should, but occasionally will spontaneously reset back to event 01 and start over.

Same story for the motion capture, except I can't get camera 2 to trigger on motion any more. I even copied the camera2.conf file to camera1.conf and made the name changes manually, but that didn't help. Nothing really out of the ordinary in the logs.

motion.conf (condensed):

daemon on
setup_mode off
videodevice /dev/video0
input 0
norm 1
frequency 0
rotate 0
width 320
height 240
framerate 1
auto_brightness off
brightness 0
contrast 0
saturation 0
hue 0
roundrobin_frames 1
roundrobin_skip 2
switchfilter on
threshold 1500
threshold_tune on
noise_level 32
noise_tune off
night_compensate on
despeckle EedDl
smart_mask_speed 0
lightswitch 0
minimum_motion_frames 1
pre_capture 3
post_capture 10
gap 60
minimum_gap 0
max_mpeg_time 0
low_cpu 0
output_all off
output_normal best
output_motion off
quality 75
ppm off
ffmpeg_cap_new on
ffmpeg_cap_motion off
ffmpeg_timelapse 0
ffmpeg_timelapse_mode daily
ffmpeg_bps 500000
ffmpeg_variable_bitrate 0
ffmpeg_video_codec msmpeg4
ffmpeg_deinterlace off
snapshot_interval 3600
locate preview
text_right %Y-%m-%d\n%T-%q
text_changes off
text_event %Y%m%d%H%M%S
text_double off
target_dir /var/www/apache2-default/pumpcam
snapshot_filename CamSnap%t-%v%C
jpeg_filename preview
movie_filename cam%t-%v%C
timelapse_filename %Y%m%d-timelapse
webcam_port 8081
webcam_quality 80
webcam_motion off
webcam_maxrate 1
webcam_localhost off
webcam_limit 0
control_port 1808
control_localhost off
control_html_output on
track_type 0
track_auto off
track_motorx -1
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
sql_log_image on
sql_log_snapshot on
sql_log_mpeg off
sql_log_timelapse off
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')
thread /etc/motion/camera1.conf
thread /etc/motion/camera2.conf



==========================
Camera 1:
 cat camera1.conf
# /etc/motion/camera2.conf
#
# This config file was generated by motion 3.2.6


# The video input to be used (default: 8)
# Should normally be set to 1 for video/TV cards, and 8 for USB cameras
input 0

# File path for snapshots (jpeg or ppm) relative to target_dir
# Default: %v-%Y%m%d%H%M%S-snapshot
# Default value is equivalent to legacy oldlayout option
# For Motion 3.0 compatible mode choose: %Y/%m/%d/%H/%M/%S-snapshot
# File extension .jpg or .ppm is automatically added so do not include this.
# Note: A symbolic link called lastsnap.jpg created in the target_dir will always
# point to the latest snapshot, unless snapshot_filename is exactly 'lastsnap'
snapshot_filename pumpcamsnap%v

# File path for motion triggered ffmpeg films (mpeg) relative to target_dir
# Default: %v-%Y%m%d%H%M%S
# Default value is equivalent to legacy oldlayout option
# For Motion 3.0 compatible mode choose: %Y/%m/%d/%H%M%S
# File extension .mpg or .avi is automatically added so do not include this
# This option was previously called ffmpeg_filename
movie_filename pumpcam-%v


############################################################
# Live Webcam Server
############################################################

# The mini-http server listens to this port for requests (default: 0 = disabled)
webcam_port 8081


================================
Camera 2:
# /etc/motion/camera2.conf
#
# This config file was generated by motion 3.2.6


# The video input to be used (default: 8)
# Should normally be set to 1 for video/TV cards, and 8 for USB cameras
input 1

# File path for snapshots (jpeg or ppm) relative to target_dir
# Default: %v-%Y%m%d%H%M%S-snapshot
# Default value is equivalent to legacy oldlayout option
# For Motion 3.0 compatible mode choose: %Y/%m/%d/%H/%M/%S-snapshot
# File extension .jpg or .ppm is automatically added so do not include this.
# Note: A symbolic link called lastsnap.jpg created in the target_dir will always
# point to the latest snapshot, unless snapshot_filename is exactly 'lastsnap'
snapshot_filename drivecamsnap%v

# File path for motion triggered ffmpeg films (mpeg) relative to target_dir
# Default: %v-%Y%m%d%H%M%S
# Default value is equivalent to legacy oldlayout option
# For Motion 3.0 compatible mode choose: %Y/%m/%d/%H%M%S
# File extension .mpg or .avi is automatically added so do not include this
# This option was previously called ffmpeg_filename
movie_filename drivecam-%v


############################################################
# Live Webcam Server
############################################################

# The mini-http server listens to this port for requests (default: 0 = disabled)
webcam_port 8082


Environment

Motion version: 3.2.6
ffmpeg version:  
Libraries: ffmpeg, mysql, postgresql
Server OS: Debian 1:3.3.5-13, kernel 2.4.27-3-k7

-- DavidPowell - 19 Jun 2006

Answer

The %v event counter is reset each time you restart Motion. It increases by one each time an event gap time has passed with no motion detected. Ie. 60 seconds in your case of no motion detected. The way you use %v some places means that Motion overwrites the same file again and again until a new event happens. Or when you restart Motion.

Your framerate is 1. The valid range is 2 - 30 with an NTSC capture card and 2-25 with a PAL capture card. The internal logic in Motion requires that the main loop passes through twice per second or more.

-- KennethLavrsen - 19 Jun 2006

Thanks, that did the trick. I can't imagine how that setting got changed. smile As for the event counter not changing, I was under the impression that an "event" was equivalent to "snapping a picture or detecting motion" but apparently that's not entirely accurate. BTW, my wife likes the camera in your bird house. Now I have to make one!

-- DavidPowell - 23 Jun 2006
Topic revision: r4 - 27 Jun 2006, KennethLavrsen
Copyright © 1999-2019 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.