################################
#  Config File for raspimjpeg  #
################################
# Syntax: "Command Param", no spaces before/after line allowed

#
# Camera Options
#
# annotation max length: 31 characters
annotation
anno_background false
anno3_custom_background_colour 0
anno3_custom_background_Y 0
anno3_custom_background_U 128
anno3_custom_background_V 128
anno3_custom_text_colour 0
anno3_custom_text_Y 255
anno3_custom_text_U 128
anno3_custom_text_V 128
anno_text_size 50

sharpness 0
contrast 0
brightness 50
saturation 0
iso 0
metering_mode average
video_stabilisation false
exposure_compensation 0
exposure_mode auto
white_balance auto
autowbgain_r 150
autowbgain_b 150
image_effect none
colour_effect_en false
colour_effect_u 128
colour_effect_v 128
rotation 0
hflip false
vflip false
sensor_region_x 0
sensor_region_y 0
sensor_region_w 65536
sensor_region_h 65536
shutter_speed 0
raw_layer false
stat_pass 0

# camera_num 0 - no selection. 1/2 selects first or second camera on compute module
camera_num 0

#MMAL settings
minimise_frag 0
initial_quant 25
encode_qp 31
#mmal_logfile used for debugging callbacks (set to /dev/shm/mjpeg/mmallogfile for short periods only)
mmal_logfile
#sleep after stopping uSec
stop_pause 100000

#
# Preview Options
#
# fps_preview = video_fps (below) / divider
#
width 800
quality 10
divider 1

#
# Video Options
#
video_width 1640
video_height 1232
video_fps 15
video_bitrate 17000000
video_buffer 0
#h264_buffer_size 0 sets to default (65536) Higher gives smoother set of callbacks
h264_buffer_size 131072
h264_buffers 0
video_split 0

#MP4Box Off=leave as raw h264, background=box in background
MP4Box background
MP4Box_fps 25
MP4Box_cmd (set -e;MP4Box -fps %i -add %s %s > /dev/null 2>&1;rm "%s";) &
#
# Image Options
#
image_width 3280
image_height 2464
image_quality 80

#time lapse interval 0.1 sec units
tl_interval 30

#
# Motion Detection
#
motion_external true
vector_preview false
vector_mode ?
motion_noise 1010
motion_threshold 250
motion_clip 0
motion_image
motion_initframes 0
motion_startframes 3
motion_stopframes 150
motion_pipe
motion_file 0

#
# File Locations
#
# preview path: add %d for number
# image+video path: add %d for number, year, month, day, hour, minute, second
# macros_path can be used to store macros executed by sy command
# boxing_path if set is where h264 files will be temporarily stored when boxing used
# image, video and lapse may be configured relative to media_path if first / left out
base_path /home/pi/PlanktonScope/scripts/raspimjpeg/
preview_path /dev/shm/mjpeg/cam.jpg
image_path /home/pi/data/%Y%M%D/im_%i_%h%m%s.jpg
lapse_path /home/pi/media/tl_%i_%t_%Y%M%D_%h%m%s.jpg
video_path /home/pi/media/vi_%v_%Y%M%D_%h%m%s.mp4
status_file /dev/shm/mjpeg/status_mjpeg.txt
control_file /home/pi/PlanktonScope/scripts/raspimjpeg/FIFO
media_path /home/pi/data/
macros_path /home/pi/PlanktonScope/scripts/raspimjpeg/macros
user_annotate /dev/shm/mjpeg/user_annotate.txt
boxing_path
subdir_char @
count_format %04d

#Job macros - prefix with & to make it run asynchronously
error_soft error_soft.sh
error_hard error_hard.sh
start_img start_img.sh
end_img &end_img.sh
start_vid &start_vid.sh
end_vid end_vid.sh
end_box &end_box.sh
do_cmd &do_cmd.sh
motion_event motion_event.sh
startstop startstop.sh

# thumb generator control
# Set v, i, or t in string to enable thumbs for images, videos, or lapse
thumb_gen vt

#
# Autostart
#
# autostart: standard/idle
# motion detection can only be true if autostart is standard
#
autostart standard
motion_detection false

# Watchdog
# Interval in 0.1 secs
# Errors is Number of times cam.jpg doesn't change before exit
watchdog_interval 30
watchdog_errors 3
# Set callback_timeout to 0 to disable it
callback_timeout 30
#optional user_config file to overwrite (persist) changes
user_config /home/pi/PlanktonScope/scripts/raspimjpeg/uconfig

#logfile for raspimjpeg, default to merge with scheduler log
log_file /home/pi/PlanktonScope/scripts/raspimjpeg/raspimjpeg.log
log_size 10000
motion_logfile /home/pi/PlanktonScope/scripts/raspimjpeg/motion.log

#enforce_lf set to 1 to only process FIFO commands when terminated with LF
enforce_lf 1

#FIFO poll interval microseconds 1000000 minimum
fifo_interval 100000

