Linux Motion

From ElectroDragon Wiki


  • Install package:
sudo apt-get install motion
  • Basic configue:
sudo nano /etc/motion/motion.conf

Main setup

  1. turn on the daemon
daemon on
  1. turn off localhost only
webcam_localhost off
  • Advanced setup, increase web streaming speed and image size
webcam_maxrate 100 (This will allow for real-time streaming but requires more bandwidth)
framerate 100 (This will allow for 100 frames to be captured per second allowing for smooth video)
width 640 (This changes the width of the image displayed)
height 480 (This changes the height of the image displayed)

Deamon setup

  • configue the deamon
sudo nano /etc/default/motion
  • add the following lines:
  • Make sure the camera is connected and turn on the daemon of motion
sudo service motion start

or stop it

sudo service motion stop

Advanced setup (Tweak optionally)

  • Motion detect, change the parameter to on
# Output frames at 1 fps when no motion is detected and increase to the
# rate given by webcam_maxrate when motion is detected (default: off)
webcam_motion off
  • Default image saving directory
# Target base directory for pictures and films
# Recommended to use absolute path. (Default: current working directory)
target_dir /tmp/motion
  • Image output settings:
# Output 'normal' pictures when motion is detected (default: on)
# Valid values: on, off, first, best, center
# When set to 'first', only the first picture of an event is saved.
# Picture with most motion of an event is saved when set to 'best'.
# Picture with motion nearest center of picture is saved when set to 'center'.
# Can be used as preview shot for the corresponding movie.
output_normal on


  • On the webpage now you can take a look of the real time web streaming of the camera