Motion - Support Question 2016x 01x 05x 175049

Gate opening with Raspberry Pi, motion and OpenALPR

Question

My project is Automatic License Plate Recognition (OpenALPR) to open a gate. I've a Raspberry Pi 2 with integrated cam. So far I managed to install Raspian, raspistill and raspivid are working. ALPR works in standalone mode, is able to detect license plates.

I installed motion and got mixed results, mainly because, I'm unsure about the procedure to select:

- should I concentrate on jpg (one/several files ?) which implies some not-so-obvious after-event programming - or is it more practical to get a right avi ? A single avi is of course much easier, just feed it to ALPR. There are many parameters and after much trial & error I've to beg for help.

I would appreciate some feedback or hints in my context, i.e. a car approching the gate, that is a motion of 20-30sec, generating a jpg every 10sec and a avi covering the whole 30sec.

  # /etc/motion/motion.conf
  # Daemon #########################################
  daemon on
  process_id_file /var/run/motion/motion.pid 
  # Basic Setup Mode ###############################
  setup_mode off
  # Capture device options #########################
  videodevice /dev/video0
  # v4l2_palette allows to choose preferable palette to be use by motion to 
  capture from those supported by your videodevice. (default: 8)
  # E.g. if your videodevice supports both V4L2_PIX_FMT_SBGGR8 and  
  V4L2_PIX_FMT_MJPEG 
  # then motion will by default use V4L2_PIX_FMT_MJPEG.
  # Setting v4l2_palette to 1 forces motion to use V4L2_PIX_FMT_SBGGR8 instead.
  #
  # Values :
  # V4L2_PIX_FMT_SN9C10X : 0  'S910'
  # V4L2_PIX_FMT_SBGGR8  : 1  'BA81'
  # V4L2_PIX_FMT_MJPEG   : 2  'MJPEG'
  # V4L2_PIX_FMT_JPEG    : 3  'JPEG'
  # V4L2_PIX_FMT_RGB24   : 4  'RGB3'
  # V4L2_PIX_FMT_UYVY    : 5  'UYVY'
  # V4L2_PIX_FMT_YUYV    : 6  'YUYV'
  # V4L2_PIX_FMT_YUV422P : 7  '422P'
  # V4L2_PIX_FMT_YUV420  : 8  'YU12'
  v4l2_palette 8
  ; tunerdevice /dev/tuner0
  input 8
  norm 0
  frequency 0
  rotate 180
  width 1024
  height 768
  framerate 5
  minimum_frame_time 0
  ; netcam_url value
  ; netcam_userpass value
  ; netcam_http 1.0
  ; netcam_proxy value 
  netcam_tolerant_check off
  auto_brightness off
  brightness 0
  contrast 0
  saturation 0
  hue 0
  # Round Robin (multiple inputs on same video device name) #########
  roundrobin_frames 1
  roundrobin_skip 1
  switchfilter off

  # Motion Detection Settings ##################################
  threshold 20000
  threshold_tune off
  noise_level 32
  noise_tune on
  # Despeckle motion image using (e)rode or (d)ilate or (l)abel (Default: not 
  defined)
  # Recommended value is EedDl. Any combination (and number of) of E, e, d, 
  and D is valid.
  # (l)abeling must only be used once and the 'l' must be the last letter.
  despeckle EedDl
  area_detect 258
  ; mask_file value
  smart_mask_speed 0
  lightswitch 0
  minimum_motion_frames 5
  pre_capture 0
  post_capture 0
  gap 10
  max_mpeg_time 30
  output_all off
  # Image File Output ##################################################
  output_normal best
  output_motion off
  quality 85
  ppm off
  # FFMPEG related options #########################################
  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 mpeg4
  ffmpeg_deinterlace off
  # Snapshots (Traditional Periodic Webcam File Output) ################
  snapshot_interval 0
  # Text Display ######################
  # %Y = year, %m = month, %d = date,
  # %H = hour, %M = minute, %S = second, %T = HH:MM:SS,
  # %v = event, 
  # %q = frame number, 
  # %t = thread (camera) number,
  # %D = changed pixels, 
  # %N = noise level, 
  # \n = new line,
  # %i and %J = width and height of motion area,
  # %K and %L = X and Y coordinates of motion center
  # %C = value defined by text_event - do not use with text_event!
  locate off
  # text_right %Y-%m-%d\n%T-%q
  # text_left CAMERA %t
  text_changes off
  # This option defines the value of the special event conversion specifier %C
  # You can use any conversion specifier in this option except %C. 
  # Date and time  values are from the timestamp of the first image in the 
  current event.
  # Default: %Y%m%d%H%M%S
  # The idea is that %C can be used filenames and text_left/right for 
  creating  a unique identifier for each event.
  text_event %Y%m%d%H%M%S
  text_double off
  ############################################################
  # Target Directories and filenames for Images And Films
  # For the options snapshot_, jpeg_, mpeg_ and timelapse_filename
  # you can use conversion specifiers
  # %Y = year, %m = month, %d = date,
  # %H = hour, %M = minute, %S = second,
  # %v = event, %q = frame number, %t = thread (camera) number,
  # %D = changed pixels, %N = noise level,
  # %i and %J = width and height of motion area,
  # %K and %L = X and Y coordinates of motion center
  # %C = value defined by text_event
  # Quotation marks round string are allowed.
  ############################################################
  target_dir /data/webcam/motion
  # 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 %v-%Y%m%d%H%M%S-snapshot
  snapshot_filename pic-snap
  # File path for motion triggered images (jpeg or ppm) relative to target_dir
  # Default: %v-%Y%m%d%H%M%S-%q
  # Default value is equivalent to legacy oldlayout option
  # For Motion 3.0 compatible mode choose: %Y/%m/%d/%H/%M/%S-%q
  # File extension .jpg or .ppm is automatically added so do not include this
  # Set to 'preview' together with best-preview feature enables special naming
  # convention for preview shots.
  # See motion guide for details
  # jpeg_filename %v-%Y%m%d%H%M%S-%q
  jpeg_filename pic-motion
  # 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 %v-%Y%m%d%H%M%S
  movie_filename pic-movie
  # File path for timelapse mpegs relative to target_dir
  # Default: %Y%m%d-timelapse
  # Default value is near equivalent to legacy oldlayout option
  # For Motion 3.0 compatible mode choose: %Y/%m/%d-timelapse
  # File extension .mpg is automatically added so do not include this
  timelapse_filename %Y%m%d-timelapse
  # Live Webcam Server ###############################
  webcam_port 8080
  webcam_quality 85
  webcam_motion off
  webcam_maxrate 1
  webcam_localhost off
  webcam_limit 0

  # HTTP Based Control ##############################
  control_port 8081
  control_localhost on
  control_html_output on
  ; control_authentication username:password

  # Tracking (Pan/Tilt) ###########################
  # External Commands, Warnings and Logging:
  # You can use conversion specifiers for the on_xxxx commands
  # %Y = year, %m = month, %d = date,
  # %H = hour, %M = minute, %S = second,
  # %v = event, %q = frame number, %t = thread (camera) number,
  # %D = changed pixels, %N = noise level,
  # %i and %J = width and height of motion area,
  # %K and %L = X and Y coordinates of motion center
  # %C = value defined by text_event
  # %f = filename with full path
  # %n = number indicating filetype
  # Both %f and %n are only defined for on_picture_save,  on_movie_start and 
  on_movie_end
  ############################################################
  quiet on
  on_event_start /home/pi/.motion/echostart
  on_event_end /home/pi/.motion/echoend
  ; on_picture_save value
  ; on_motion_detected value
  ; on_area_detected value
  ; on_movie_start value
  ; on_movie_end value
  ; on_camera_lost value
  ############################################################
  # Common Options For MySQL and PostgreSQL database features.
  # Database Options For MySQL
  # Database Options For PostgreSQL
  # Video Loopback Device (vloopback project)
  ############################################################
  ; video_pipe value
  ; motion_video_pipe value
  ##############################################################
  # Thread config files - One for each camera.
  ##############################################################
  # thread config files. 
  ; thread /usr/local/etc/thread1.conf
  ; thread /usr/local/etc/thread2.conf
  ; thread /usr/local/etc/thread3.conf
  ; thread /usr/local/etc/thread4.conf









Environment

Motion version: 3.2.12
ffmpeg version: N-77432-gc0f67e1
Libraries: ffmpeg
Server OS: Raspbian GNU/Linux 7 \n \l
-- RaymondWarichet - 05 Jan 2016

Answer

Topic revision: r1 - 06 Jan 2016, RaymondWarichet
Copyright © 1999-2017 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.