### MariaDB Installation and Setup Source: https://github.com/motion-project/motion/blob/master/doc/motion_examples.html Commands to install MariaDB, grant privileges, create the 'motion' database, and configure Motion to use it. Ensure MariaDB is running via systemctl after setup. ```bash sudo apt install libmariadb-dev libmariadb3 mariadb-client mariadb-client-core mariadb-common mariadb-server sudo mariadb GRANT ALL ON *.* TO 'YourUserNameHere'@'localhost' IDENTIFIED BY 'YourPasswordHere' WITH GRANT OPTION; FLUSH PRIVILEGES; exit mariadb -u YourUserNameHere -p {enter YourPasswordHere} create database motion; use motion; quit; ``` ```bash sudo systemctl status mariadb ``` -------------------------------- ### PostgreSQL Installation and Setup Source: https://github.com/motion-project/motion/blob/master/doc/motion_examples.html Commands to install PostgreSQL, create a role and database for Motion, and grant privileges. Verify PostgreSQL status and test login using the provided psql command. ```bash sudo apt install postgresql postgresql-contrib sudo -u postgres psql CREATE ROLE 'your_username_here' LOGIN PASSWORD 'YourPasswordHere'; CREATE DATABASE motion WITH OWNER = your_username_here; GRANT ALL PRIVILEGES ON DATABASE motion TO your_username_here; \quit ``` ```bash sudo systemctl status postgresql ``` ```bash psql -h localhost -d motion -U your_username_here -p 5432 ``` -------------------------------- ### SQL Query for Event Start Source: https://github.com/motion-project/motion/blob/master/doc/motion_config.html Example of an SQL query to be executed at the start of an event. This is a placeholder and should be replaced with a valid SQL statement. ```sql sql_event_start ``` -------------------------------- ### Start Event Action Source: https://github.com/motion-project/motion/blob/master/doc/motion_examples.html Example command to start an event using curl. This action can be used to manually trigger an event. ```bash curl -s -o -X POST {IP}:{port0} --data-urlencode "camid={camid}" --data-urlencode "command=eventstart" 1>/dev/null ``` -------------------------------- ### SQL Query for Movie Start Source: https://github.com/motion-project/motion/blob/master/doc/motion_config.html Example of an SQL query to be executed at the start of a movie recording. This is a placeholder and should be replaced with a valid SQL statement. ```sql sql_movie_start ``` -------------------------------- ### Encrypting a Message Using GPG Source: https://github.com/motion-project/motion/wiki/Privacy This example shows how to fetch a GPG public key, import it, and then encrypt a message for a specific recipient using GPG. Ensure you have GPG installed and the recipient's key imported. ```bash $ curl --silent https://api.github.com/users/tosiara/gpg_keys | jq -r '.[0].raw_key' > tosiara.asc $ gpg --import < tosiara.asc $ echo "See my example video at https://youtube/blahblah" | gpg -e -a -r tosiara@users.noreply.github.com ``` ```plaintext -----BEGIN PGP MESSAGE----- Version: GnuPG v1 hQEMAzwWtUGzwX+nAQf/ZHMgAZ8LoYr77n/jqkSbhYvgsnn7Ct6eY4JcXg2ioA40 J0zHy8P6d/VL5JSZByEuq24AB0e6do4M9dpWHcNbjI5VtzjiC3EsisMSpc2+fi4e MUeYzGXHVTWSZqLTOX/mI6rbUQ52MLCzrW6RK4XQolQOcbjppOxz93f/Zy3mhctj bFtgR0dXsRSuCzXX8Lk8sDnTmib2D7r/cmEkmBa7doD7Gr8dUzTzuncB+ek2S8LB zfyw89KKA5jfYjnHLy3ZfT6p4fuJjzJb7YGI2uVFHFnllLvTvbAwPdkFKYbdGtzy ngH2ekJAyc4NA6vsjJXmcMuPgFqW+fGgcAffiahB+tJpAR4AslTFyaZ2QoGL1w+Z Vx1xjYX+ExK4hUebLPr63AoWsv82YRkbwgrln0UshFTjzym2aQGTo2+HYwNOfDlM ABRO+sHyatUxcxvYk8EhwyvUbRMx6NVG/UhT/YaIz5Ir5hAYxI6aa/ZX =bbxQ -----END PGP MESSAGE----- ``` -------------------------------- ### Camera Configuration Example Source: https://github.com/motion-project/motion/blob/master/doc/motion_config.html Illustrates how to configure individual cameras with row and column parameters for streaming. ```config stream_allcam_params row=3,col=1 ``` ```config stream_allcam_params row=1,col=2 ``` ```config stream_allcam_params row=3,col=3 ``` ```config stream_allcam_params row=1,col=1 ``` ```config stream_allcam_params row=3,col=2 ``` ```config stream_allcam_params row=2,col=1 ``` -------------------------------- ### Configure Multiple Webcontrol Ports Source: https://github.com/motion-project/motion/blob/master/doc/motion_examples.html Example configuration for setting up different webcontrol ports with varying access levels for cameras. ```config motion.conf * webcontrol_port 8080 * webcontrol_access 3 camera1.conf * webcontrol_port 8081 * webcontrol_access 0 ``` -------------------------------- ### Build Motion from Source Source: https://github.com/motion-project/motion/blob/master/doc/motion_build.html Clones the Motion repository, navigates into the directory, and runs the build process. This includes autoreconf, configure, make, and make install. ```bash cd ~ git clone https://github.com/Motion-Project/motion.git cd motion autoreconf -fiv ./configure make make install ``` -------------------------------- ### Install and Activate v4l2loopback Device Source: https://github.com/motion-project/motion/blob/master/doc/motion_examples.html Instructions for installing the v4l2loopback kernel module and activating it for use with Motion. This allows Motion to use a virtual video device for input or output. ```bash sudo modprobe v4l2loopback ``` -------------------------------- ### Install Build Dependencies on Debian Source: https://github.com/motion-project/motion/blob/master/doc/motion_build.html Installs essential packages required for building Motion on Debian-based systems. Includes libraries for video, image processing, and databases. ```bash sudo apt install autoconf automake autopoint build-essential pkgconf libtool libzip-dev libjpeg-dev git libavformat-dev libavcodec-dev libavutil-dev libswscale-dev libavdevice-dev libopencv-dev libwebp-dev gettext libmicrohttpd-dev libmariadb-dev libcamera-dev libcamera-tools libcamera-v4l2 libasound2-dev libpulse-dev libfftw3-dev ``` -------------------------------- ### Optional Database Dependencies Source: https://github.com/motion-project/motion/blob/master/doc/motion_build.html Installs optional database support for PostgreSQL or SQLite3. Motion functionality may be limited without a running database. ```bash sudo apt install libpq-dev libsqlite3-dev ``` -------------------------------- ### Motion Command Line Options Source: https://github.com/motion-project/motion/blob/master/doc/motion_config.html Use these options to control how Motion starts and runs. Specify configuration file paths, log levels, and daemon modes. ```bash motion [ -hbnm ] [ -c config file path ] [ -d level ] [ -k level ] [ -p pid_file ] [ -l log_file ] ``` -------------------------------- ### FFmpeg with Gray Pixel Format Source: https://github.com/motion-project/motion/blob/master/doc/motion_examples.html This example demonstrates reformatting the video stream to a gray pixel format using FFmpeg before feeding it into the loopback device for Motion. ```bash ffmpeg -re -i mymovie.mp4 -f v4l2 -pix_fmt gray /dev/video0 ``` -------------------------------- ### SQL Query for Picture Save Source: https://github.com/motion-project/motion/blob/master/doc/motion_config.html Example of an SQL query to be executed when a picture is saved. This is a placeholder and should be replaced with a valid SQL statement. ```sql sql_pic_save ``` -------------------------------- ### SQLite3 Database Configuration Source: https://github.com/motion-project/motion/blob/master/doc/motion_examples.html Configuration parameters for setting up a file-based SQLite3 database for Motion. This is the simplest setup but can be unstable if the database file is archived while in use. ```ini database_type sqlite3 database_dbname /full/path/and/file/name.db ``` -------------------------------- ### SQL Query for Event End Source: https://github.com/motion-project/motion/blob/master/doc/motion_config.html Example of an SQL query to be executed at the end of an event. This is a placeholder and should be replaced with a valid SQL statement. ```sql sql_event_end ``` -------------------------------- ### curl PTZ Control Commands (Example 2) Source: https://github.com/motion-project/motion/blob/master/doc/motion_examples.html Control camera PTZ movements (left, right, down, up, zoom in/out) using curl with specific CGI parameters. Each command is followed by a stop command after a short delay. ```bash #!/bin/bash curl 'http://admin:admin@cameraip:80/web/cgi-bin/hi3510/ptzctrl.cgi?-step=0&-act=left&-speed=45' sleep 1 curl 'http://admin:admin@cameraip:80/web/cgi-bin/hi3510/ptzctrl.cgi?-step=0&-act=stop&-speed=45' exit ``` ```bash #!/bin/bash curl 'http://admin:admin@cameraip:80/web/cgi-bin/hi3510/ptzctrl.cgi?-step=0&-act=right&-speed=45' sleep 1 curl 'http://admin:admin@cameraip:80/web/cgi-bin/hi3510/ptzctrl.cgi?-step=0&-act=stop&-speed=45' exit ``` ```bash #!/bin/bash curl 'http://admin:admin@cameraip:80/web/cgi-bin/hi3510/ptzctrl.cgi?-step=0&-act=down&-speed=45' sleep 1 curl 'http://admin:admin@cameraip:80/web/cgi-bin/hi3510/ptzctrl.cgi?-step=0&-act=stop&-speed=45' exit ``` ```bash #!/bin/bash curl 'http://admin:admin@cameraip:80/web/cgi-bin/hi3510/ptzctrl.cgi?-step=0&-act=up&-speed=45' sleep 1 curl 'http://admin:admin@cameraip:80/web/cgi-bin/hi3510/ptzctrl.cgi?-step=0&-act=stop&-speed=45' exit ``` ```bash #!/bin/bash curl 'http://admin:admin@cameraip:80/web/cgi-bin/hi3510/ptzctrl.cgi?-step=0&-act=zoomin&-speed=45' sleep 1 curl 'http://admin:admin@cameraip:80/web/cgi-bin/hi3510/ptzctrl.cgi?-step=0&-act=stop&-speed=45' exit ``` ```bash #!/bin/bash curl 'http://admin:admin@cameraip:80/web/cgi-bin/hi3510/ptzctrl.cgi?-step=0&-act=zoomout&-speed=45' sleep 1 curl 'http://admin:admin@cameraip:80/web/cgi-bin/hi3510/ptzctrl.cgi?-step=0&-act=stop&-speed=45' exit ``` -------------------------------- ### curl PTZ Turn Commands (Example 1) Source: https://github.com/motion-project/motion/blob/master/doc/motion_examples.html Control camera PTZ direction (Up, Down, Left, Right) using curl PUT requests. The Param1 value of '1' initiates movement, and '0' stops it. ```bash #!/bin/bash curl -X PUT -H "Content-Type: application/x-www-form-urlencoded" -d 'Param1=1' http://admin@cameraip:80/PTZ/1/TurnDown sleep 2 curl -X PUT -H "Content-Type: application/x-www-form-urlencoded" -d 'Param1=0' http://admin@cameraip:80/PTZ/1/TurnDown exit ``` ```bash #!/bin/bash curl -X PUT -H "Content-Type: application/x-www-form-urlencoded" -d 'Param1=1' http://admin@cameraip:80/PTZ/1/TurnLeft sleep 2 curl -X PUT -H "Content-Type: application/x-www-form-urlencoded" -d 'Param1=0' http://admin@cameraip:80/PTZ/1/TurnLeft exit ``` ```bash #!/bin/bash curl -X PUT -H "Content-Type: application/x-www-form-urlencoded" -d 'Param1=1' http://admin@cameraip:80/PTZ/1/TurnRight sleep 2 curl -X PUT -H "Content-Type: application/x-www-form-urlencoded" -d 'Param1=0' http://admin@cameraip:80/PTZ/1/TurnRight exit ``` ```bash #!/bin/bash curl -X PUT -H "Content-Type: application/x-www-form-urlencoded" -d 'Param1=1' http://admin@cameraip:80/PTZ/1/TurnUp sleep 2 curl -X PUT -H "Content-Type: application/x-www-form-urlencoded" -d 'Param1=0' http://admin@cameraip:80/PTZ/1/TurnUp exit ``` -------------------------------- ### SQL Query for Movie End Source: https://github.com/motion-project/motion/blob/master/doc/motion_config.html Example of an SQL query to be executed at the end of a movie recording. This is a placeholder and should be replaced with a valid SQL statement. ```sql sql_movie_end ``` -------------------------------- ### Make Options for Motion Build Source: https://github.com/motion-project/motion/blob/master/doc/motion_build.html Provides make commands for cleaning the build directory and performing developer checks. 'make cleanall' creates a pristine directory, while 'make maintainer-check' runs various build combinations. ```bash make cleanall make maintainer-check make maintainer-clang ``` -------------------------------- ### Configure Script Options for Motion Source: https://github.com/motion-project/motion/blob/master/doc/motion_build.html Lists custom configure options for building Motion. Use --without- to exclude support or --with-=DIR to specify a directory. ```bash --without-v4l2 --without-webp --with-libcam=DIR --with-ffmpeg=DIR --with-opencv=DIR --with-mariadb=DIR --with-mysql=DIR --with-pgsql=DIR --with-sqlite3=DIR --with-pulse=DIR --with-alsa=DIR --with-fftw3=DIR --with-developer-flags ``` -------------------------------- ### Specifying libcamera Device Source: https://github.com/motion-project/motion/blob/master/doc/motion_config.html Set the libcamera device to be used. 'camera0' uses the first available device. Otherwise, specify the device description from the log or `cam -l` output. ```config libcam_device camera0 ``` -------------------------------- ### Use FFmpeg with Loopback Device Source: https://github.com/motion-project/motion/blob/master/doc/motion_examples.html This snippet shows how to use FFmpeg to feed video into a loopback device (/dev/video0) which Motion can then read. This is useful when a device works with FFmpeg but not directly with Motion. ```bash ffmpeg -re -i mymovie.mp4 -f v4l2 /dev/video0 ``` -------------------------------- ### Sample extpipe Commands for Video Encoding Source: https://github.com/motion-project/motion/blob/master/doc/motion_examples.html These commands demonstrate how to use external tools like mencoder and ffmpeg with Motion's 'movie_extpipe' option for video encoding. They cover different output formats and encoding presets. ```bash movie_extpipe mencoder -demuxer rawvideo -rawvideo w=%w:h=%h:i420 -ovc x264 -x264encopts bframes=4:frameref=1:subq=1:scenecut=-1:nob_adapt:threads=1:keyint=1000:8x8dct:vbv_bufsize=4000:crf=24:partitions=i8x8,i4x4:vbv_maxrate=800:no-chroma-me -vf denoise3d=16:12:48:4,pp=lb -of avi -o %f.avi - -fps %{fps} ``` ```bash movie_extpipe x264 - --input-res %wx%h --fps %{fps} --bitrate 2000 --preset ultrafast --quiet -o %f.mp4 ``` ```bash movie_extpipe mencoder -demuxer rawvideo -rawvideo w=%w:h=%h:fps=%{fps} -ovc x264 -x264encopts preset=ultrafast -of lavf -o %f.mp4 - -fps %{fps} ``` ```bash movie_extpipe ffmpeg -y -f rawvideo -pix_fmt yuv420p -video_size %wx%h -framerate %{fps} -i pipe:0 -vcodec libx264 -preset ultrafast -f mp4 %f.mp4 ``` -------------------------------- ### Configure Sound Alerts in Motion Source: https://github.com/motion-project/motion/blob/master/doc/motion_examples.html Set up sound device, enable frequency display, and define alert conditions based on frequency ranges. Use this to monitor specific sound events. ```config snd_device hw:1,0 snd_show on snd_alerts alert_id=01,volume_level=01,volume_count=10,freq_low=2976,freq_high=2977,alert_nm=smokedown1 snd_alerts alert_id=02,volume_level=01,volume_count=10,freq_low=3400,freq_high=3450,alert_nm=smokelr snd_alerts alert_id=03,volume_level=01,volume_count=10,freq_low=3388,freq_high=3399,alert_nm=smokebr1 snd_alerts alert_id=11,volume_level=01,volume_count=10,freq_low=3378,freq_high=3379,alert_nm=furnace snd_alerts alert_id=22,volume_level=01,volume_count=10,freq_low=3281,freq_high=3399,alert_nm=waterheater snd_alerts alert_id=22,volume_level=01,volume_count=10,freq_low=3270,freq_high=3279,alert_nm=kitchBath snd_show off on_sound_alert %{trig_nbr} %{trig_nm} %{trig_freq} ``` -------------------------------- ### HTML for Tiled Camera Streams Source: https://github.com/motion-project/motion/wiki/FAQ Create this HTML file to view all your Motion camera streams in a tiled layout. Replace 'ipaddress:portnumber' with your camera's actual IP address and port. ```html ``` -------------------------------- ### Setting Lux (libcamera) Source: https://github.com/motion-project/motion/blob/master/doc/motion_config.html Report the ambient light level in lux. This is typically read from the sensor and may not be directly configurable. ```config Lux 100.5 ``` -------------------------------- ### Download Build Script Source: https://github.com/motion-project/motion/blob/master/doc/motion_build.html Downloads the builddeb.sh script used to create deb packages from the Motion source code. ```bash wget https://raw.githubusercontent.com/Motion-Project/motion-packaging/master/builddeb.sh ``` -------------------------------- ### Access Camera Configuration JSON Source: https://github.com/motion-project/motion/blob/master/doc/motion_examples.html URL to retrieve a JSON object containing configuration information for all cameras. ```url {IP}:{port0}/0/config.json ``` -------------------------------- ### MariaDB Motion Configuration Source: https://github.com/motion-project/motion/blob/master/doc/motion_examples.html Motion configuration parameters for connecting to a MariaDB database. Replace placeholders with your actual database credentials. ```ini database_type mariadb database_dbname motion database_host localhost database_port 3306 database_user YourUserNameHere database_password YourPasswordHere ``` -------------------------------- ### PostgreSQL Motion Configuration Source: https://github.com/motion-project/motion/blob/master/doc/motion_examples.html Motion configuration parameters for connecting to a PostgreSQL database. Ensure the username is in lowercase as indicated. ```ini database_type postgresql database_dbname motion database_host localhost database_port 5432 database_user your_username_here database_password YourPasswordHere ``` -------------------------------- ### Setting v4l2 Parameters by Name Source: https://github.com/motion-project/motion/blob/master/doc/motion_config.html Configure v4l2 device parameters using their names. Ensure the parameter names are valid for your device. ```config v4l2_params Brightness=130,palette=15 ``` -------------------------------- ### Access Home HTML Page Source: https://github.com/motion-project/motion/blob/master/doc/motion_examples.html URL to access the main HTML page which includes streams for all cameras. ```url {IP}:{port0}/ ``` -------------------------------- ### Setting Exposure Time (libcamera) Source: https://github.com/motion-project/motion/blob/master/doc/motion_config.html Set the exposure time in microseconds for the libcamera device. Shorter times reduce motion blur but require more light. ```config ExposureTime 33000 ``` -------------------------------- ### Run Motion Standalone Source: https://github.com/motion-project/motion/wiki/FAQ Instructions for running Motion manually after stopping MotionEye. Ensure you are in the correct directory and specify the configuration file, debug level, and no-daemon mode. ```bash stop motionEye: /etc/init.d/S85motioneye stop run motion manually: cd /data/etc ; motion -c motion.conf -d 5 -n ``` -------------------------------- ### Search for Sensitive Information in Files Source: https://github.com/motion-project/motion/wiki/Privacy Use grep to find common patterns of sensitive data in log and configuration files before uploading them. This helps identify potential security risks. ```bash grep -i "netcam_url\|netcam_userpass\|stream_authentication\|webcontrol_authentication\|database_password\|Network Camera\|Authorization: Basic\|http://\|https://\|ftp://\|password\|target_dir\|on_picture_save\|on_movie_end" motion.log motion.conf ``` -------------------------------- ### Action Execution Source: https://github.com/motion-project/motion/blob/master/doc/motion_examples.html Execute various actions on the Motion system by sending POST requests to the webcontrol port. These actions range from starting/stopping events to reconfiguring cameras. ```APIDOC ## POST /{IP}:{port0}/ ### Description Execute actions on the Motion system. ### Method POST ### Endpoint `{IP}:{port0}/` ### Parameters #### Request Body - **camid** (integer) - Required - The ID of the camera to perform the action on. Use 0 for all cameras. - **command** (string) - Required - The action to execute. Possible values include: `eventstart`, `eventend`, `snapshot`, `pause_on`, `pause_off`, `pause_schedule`, `restart`, `stop`, `config_write`, `camera_add`, `camera_delete`, `config`, `action_user`, `pan_left`, `pan_right`, `tilt_up`, `tilt_down`, `zoom_in`, `zoom_out`. ### Request Example ```json { "camid": "{camid}", "command": "eventstart" } ``` ### Example Usage ```bash curl -s -o -X POST {IP}:{port0} --data-urlencode "camid={camid}" --data-urlencode "command=eventstart" 1>/dev/null ``` ``` -------------------------------- ### Setting Auto White Balance Mode (libcamera) Source: https://github.com/motion-project/motion/blob/master/doc/motion_config.html Select the auto white balance mode. Options include auto, incandescent, fluorescent, daylight, and custom. ```config AwbMode AwbDaylight ``` -------------------------------- ### sofiactl PTZ Commands Source: https://github.com/motion-project/motion/blob/master/doc/motion_examples.html Use sofiactl.pl to send PTZ commands like zoom and directional movements. Adjust user, host, and port as needed. ```bash #!/bin/bash sofiactl.pl --user admin --host cameraip --port 34567 --command OPPTZControl --sd ZoomTile --s2 0.5 sofiactl.pl --user admin --host cameraip --port 34567 --command OPPTZControl --sd ZoomWide --s2 0.5 sofiactl.pl --user admin --host cameraip --port 34567 --command OPPTZControl --sd DirectionUp --s2 2.0 sofiactl.pl --user admin --host cameraip --port 34567 --command OPPTZControl --sd DirectionDown --s2 2.0 sofiactl.pl --user admin --host cameraip --port 34567 --command OPPTZControl --sd DirectionLeft --s2 2.0 sofiactl.pl --user admin --host cameraip --port 34567 --command OPPTZControl --sd DirectionRight --s2 2.0 exit ``` -------------------------------- ### Run motioneyeos Standalone Source: https://github.com/motion-project/motion/wiki/motioneye Stop the motioneye service and run motion in standalone mode with debug logging. Use this to diagnose issues specific to motioneyeos. ```bash /etc/init.d/S85motioneye stop cd /data/etc motion -c motion.conf -d 6 -n ``` -------------------------------- ### Setting Auto Focus Metering (libcamera) Source: https://github.com/motion-project/motion/blob/master/doc/motion_config.html Specify the auto focus metering mode. Options include auto and windowed. ```config AfMetering AfMeteringWindows ``` -------------------------------- ### Generate Positive Image List for Training Source: https://github.com/motion-project/motion/blob/master/doc/motion_examples.html Creates a list of positive image files for Haar model training. It iterates through JPG files in a directory and formats their information for the training process. ```bash #!/bin/bash FILES=./pos/*.jpg for FULLNAME in $FILES do HW=$(identify -format '%w %h' $FULLNAME) printf "$FULLNAME 1 0 0 $HW \n" >>poslist.txt done ``` -------------------------------- ### Generate Negative Image List for Training Source: https://github.com/motion-project/motion/blob/master/doc/motion_examples.html Creates a list of negative image files for Haar model training. It iterates through JPG files in a directory and adds their paths to a negative list file. ```bash #!/bin/bash FILES=./neg/*.jpg for FULLNAME in $FILES do printf "$FULLNAME \n" >>neglist.txt done ``` -------------------------------- ### Setting Auto Focus Windows (libcamera) Source: https://github.com/motion-project/motion/blob/master/doc/motion_config.html Define specific regions for auto focus evaluation. This is a pipe-delimited string specifying x, y, height, and width. ```config AfWindows 200|200|300|400 ``` -------------------------------- ### Create Haar Samples for Training Source: https://github.com/motion-project/motion/blob/master/doc/motion_examples.html Generates positive samples for Haar model training using OpenCV. Requires positive images and specifies output file, number of samples, and image dimensions. ```bash opencv_createsamples -vec posfiles.vec -info poslist.txt -num 350 -h 96 -w 96 ``` -------------------------------- ### Run motioneye Standalone Source: https://github.com/motion-project/motion/wiki/motioneye Stop the motioneye service (using systemd or sysvinit) and run motion in standalone mode with debug logging. Use this to diagnose issues specific to motioneye. ```bash systemctl stop motioneye # for systemd /etc/init.d/motioneye stop # for sysvinit cd /etc/motioneye motion -c motion.conf -d 6 -n ``` -------------------------------- ### Setting Auto Exposure Mode (libcamera) Source: https://github.com/motion-project/motion/blob/master/doc/motion_config.html Specify the auto exposure mode. Options include normal, short, long, and custom exposure. ```config AeExposureMode ExposureShort ``` -------------------------------- ### Configure Motion Framerate via Webcontrol Source: https://github.com/motion-project/motion/blob/master/doc/motion_examples.html Use this curl command to set the framerate for a specific camera via the webcontrol interface. Ensure you replace {IP}, {port0}, and {camid} with your actual values. ```bash curl -s -o -X POST {IP}:{port0} --data-urlencode "camid={camid}" --data-urlencode "command=config" --data-urlencode "framerate=12" 1>/dev/null ``` -------------------------------- ### Setting Scaler Crop (libcamera) Source: https://github.com/motion-project/motion/blob/master/doc/motion_config.html Define a cropping region for the libcamera scaler. This is a pipe-delimited string specifying x, y, height, and width. ```config ScalerCrop 100|100|720|1280 ``` -------------------------------- ### Setting Sensor Black Levels (libcamera) Source: https://github.com/motion-project/motion/blob/master/doc/motion_config.html Configure the black level compensation for the libcamera sensor. This is a pipe-delimited string of four values. ```config SensorBlackLevels 64|64|64|64 ``` -------------------------------- ### Setting Sensor Temperature (libcamera) Source: https://github.com/motion-project/motion/blob/master/doc/motion_config.html Report the sensor temperature in degrees Celsius. This is typically a read-only value from the sensor. ```config SensorTemperature 45.5 ``` -------------------------------- ### Static Source Image Source: https://github.com/motion-project/motion/blob/master/doc/motion_examples.html URL for the static source image of a specific camera. Specify {camid} as 0 for a consolidated image. ```url {IP}:{port0}/{camid}/static/source ``` -------------------------------- ### PTZ Pan Left Script Configuration Source: https://github.com/motion-project/motion/blob/master/doc/motion_config.html Specifies the script to execute for panning the camera to the left. Ensure the script is located in the 'scripts' subdirectory. ```config ptz_pan_left ``` -------------------------------- ### Setting Frame Duration Limits (libcamera) Source: https://github.com/motion-project/motion/blob/master/doc/motion_config.html Define the minimum and maximum allowed frame durations in microseconds for the libcamera device. This is a pipe-delimited string of two values. ```config FrameDurationLimits 10000|50000 ``` -------------------------------- ### Enabling Auto White Balance (libcamera) Source: https://github.com/motion-project/motion/blob/master/doc/motion_config.html Enable automatic white balance control for the libcamera device. This helps to ensure accurate color reproduction under different lighting conditions. ```config AwbEnable true ``` -------------------------------- ### Setting Contrast (libcamera) Source: https://github.com/motion-project/motion/blob/master/doc/motion_config.html Adjust the contrast level for the libcamera device. This affects the difference between light and dark areas in the image. ```config Contrast 1.2 ``` -------------------------------- ### Setting Colour Correction Matrix (libcamera) Source: https://github.com/motion-project/motion/blob/master/doc/motion_config.html Apply a custom color correction matrix to the libcamera device. This is a pipe-delimited string of nine values. ```config ColourCorrectionMatrix 1.0|0.0|0.0|0.0|1.0|0.0|0.0|0.0|1.0 ``` -------------------------------- ### camxmctl Placeholder Source: https://github.com/motion-project/motion/blob/master/doc/motion_examples.html Placeholder for camxmctl, a C++ program that controls cameras using JSON files and commands. Refer to its sample HTML page for specific POST commands. ```bash #!/bin/bash tbd. Review sample page to see post commands. exit ``` -------------------------------- ### Access Camera Status JSON Source: https://github.com/motion-project/motion/blob/master/doc/motion_examples.html URL to retrieve a JSON object with status information for all cameras. ```url {IP}:{port0}/0/status.json ``` -------------------------------- ### PTZ Auto Tracking Script Configuration Source: https://github.com/motion-project/motion/blob/master/doc/motion_config.html Specifies the script to execute for automatic PTZ tracking. Ensure the script is located in the 'scripts' subdirectory. ```config ptz_move_track ``` -------------------------------- ### Setting Auto Exposure Metering Mode (libcamera) Source: https://github.com/motion-project/motion/blob/master/doc/motion_config.html Set the metering mode for auto exposure. Options include center-weighted, spot, matrix, and custom. ```config AeMeteringMode MeteringMatrix ``` -------------------------------- ### Setting v4l2 Parameters by ID Source: https://github.com/motion-project/motion/blob/master/doc/motion_config.html Configure v4l2 device parameters using their numerical IDs. This method is useful when parameter names are not readily available or to ensure exact matching. ```config v4l2_params ID09963776=130,palette=15 ``` -------------------------------- ### Setting Saturation (libcamera) Source: https://github.com/motion-project/motion/blob/master/doc/motion_config.html Adjust the saturation level for the libcamera device. This controls the intensity of colors in the image. ```config Saturation 1.3 ``` -------------------------------- ### Setting Auto Focus Speed (libcamera) Source: https://github.com/motion-project/motion/blob/master/doc/motion_config.html Set the auto focus speed for the libcamera device. Options include normal and fast. ```config AfSpeed AfSpeedFast ``` -------------------------------- ### Fail2Ban Jail Configuration for Motion Detection Source: https://github.com/motion-project/motion/blob/master/doc/motion_examples.html This configuration sets up a Fail2Ban jail to actively monitor motion detection logs and ban offending IP addresses. Adjust the log path, ban time, and port range as needed for your specific environment. ```ini #Fail2Ban Jail Configuration File: /etc/fail2ban/jail.d/motion-jail.conf [motion] enabled = true filter = motion logpath = /var/log/motion/motion.log bantime = 23h banaction = iptables-allports[blocktype="DROP"] maxretry = 0 port = 0:65535 ``` -------------------------------- ### Setting Auto Focus Mode (libcamera) Source: https://github.com/motion-project/motion/blob/master/doc/motion_config.html Select the auto focus mode for the libcamera device. Options include manual, auto, and continuous. ```config AfMode AfModeContinuous ``` -------------------------------- ### Setting Colour Gains (libcamera) Source: https://github.com/motion-project/motion/blob/master/doc/motion_config.html Adjust the individual color gains (Red and Blue) for the libcamera device. This is a pipe-delimited string of two values. ```config ColourGains 1.5|1.2 ``` -------------------------------- ### Setting Colour Temperature (libcamera) Source: https://github.com/motion-project/motion/blob/master/doc/motion_config.html Set the color temperature in Kelvin for the libcamera device. This influences the overall color cast of the image. ```config ColourTemperature 5000 ``` -------------------------------- ### Static Primary Image Source: https://github.com/motion-project/motion/blob/master/doc/motion_examples.html URL for the static primary image of a specific camera. Specify {camid} as 0 for a consolidated image. ```url {IP}:{port0}/{camid}/static ``` -------------------------------- ### Setting Analogue Gain (libcamera) Source: https://github.com/motion-project/motion/blob/master/doc/motion_config.html Adjust the analogue gain for the libcamera sensor. Higher gain increases sensitivity but can also introduce noise. ```config AnalogueGain 2.0 ``` -------------------------------- ### Setting libcamera Orientation Source: https://github.com/motion-project/motion/blob/master/doc/motion_config.html Configure the orientation of the image from the libcamera device. Note that these options may not always produce the expected results. ```config Orientation Rotate90Mirror ``` -------------------------------- ### Setting Brightness (libcamera) Source: https://github.com/motion-project/motion/blob/master/doc/motion_config.html Adjust the brightness level for the libcamera device. This is a post-processing adjustment to image brightness. ```config Brightness 0.8 ``` -------------------------------- ### Access Camera Movies JSON Source: https://github.com/motion-project/motion/blob/master/doc/motion_examples.html URL to retrieve a JSON object containing information about all recorded movies. ```url {IP}:{port0}/0/movies.json ``` -------------------------------- ### Static Substream Image Source: https://github.com/motion-project/motion/blob/master/doc/motion_examples.html URL for the static substream image of a specific camera. Specify {camid} as 0 for a consolidated image. ```url {IP}:{port0}/{camid}/static/substream ``` -------------------------------- ### JSON Configuration and Status Feeds Source: https://github.com/motion-project/motion/blob/master/doc/motion_examples.html Retrieve detailed configuration and status information for cameras in JSON format. These endpoints are useful for programmatic access to camera states and settings. ```APIDOC ## GET /{IP}:{port0}/0/config.json ### Description JSON object with the configuration information for all cameras. ### Endpoint `{IP}:{port0}/0/config.json` ``` ```APIDOC ## GET /{IP}:{port0}/0/status.json ### Description JSON object with information about the status of all cameras. ### Endpoint `{IP}:{port0}/0/status.json` ``` ```APIDOC ## GET /{IP}:{port0}/0/movies.json ### Description JSON object with information about all movies. ### Endpoint `{IP}:{port0}/0/movies.json` ``` -------------------------------- ### Setting Sharpness (libcamera) Source: https://github.com/motion-project/motion/blob/master/doc/motion_config.html Adjust the sharpness level for the libcamera device. This controls the edge definition and detail in the image. ```config Sharpness 0.5 ``` -------------------------------- ### Setting Auto Exposure Constraint Mode (libcamera) Source: https://github.com/motion-project/motion/blob/master/doc/motion_config.html Define the constraint mode for auto exposure. This affects how the camera handles highlights, shadows, or normal conditions. ```config AeConstraintMode ConstraintHighlight ``` -------------------------------- ### Sending SIGUSR1 to Save Current Event Source: https://github.com/motion-project/motion/blob/master/doc/motion_config.html Send the SIGUSR1 signal to Motion to create a movie file of the current event without exiting the application. ```bash kill -s SIGUSR1 pid ``` -------------------------------- ### Set Persistent v4l2 Device Name Source: https://github.com/motion-project/motion/blob/master/doc/motion_examples.html Use udev rules to create a persistent symbolic link for a v4l2 device, ensuring a specific camera is always assigned the same device name. This is useful when multiple video devices are present and their kernel assignments may vary. ```bash KERNEL=="video[0-9]*", ATTR{name}=="Philips\ SPC\ 900NC*", SYMLINK+= "video-webcam0" ``` -------------------------------- ### Webcontrol and Stream Access Source: https://github.com/motion-project/motion/blob/master/doc/motion_examples.html Access the main HTML page which includes streams for all cameras. This is the primary entry point for viewing camera feeds through the web interface. ```APIDOC ## GET /{IP}:{port0}/ ### Description Home HTML page with streams for all cameras. ### Endpoint `{IP}:{port0}/` ``` -------------------------------- ### Setting Frame Duration (libcamera) Source: https://github.com/motion-project/motion/blob/master/doc/motion_config.html Set the desired frame duration in microseconds for the libcamera device. This influences the frame rate. ```config FrameDuration 33000 ``` -------------------------------- ### Setting v4l2 Parameters with Quoted Names Source: https://github.com/motion-project/motion/blob/master/doc/motion_config.html Configure v4l2 device parameters using their names enclosed in double quotes. This is useful if parameter names contain spaces or special characters. ```config v4l2_params "Brightness"=130,palette=15 ```