Accessing webcam from commandline on Linux

· 1min · Dmitry Scherbakov
  1. Make sure to install motion package:
    apt install motion
    
  2. To start a webcam capture, simply type motion. This will create camera view on localhost:8081 and camera control panel on localhost:8080.
  3. To adjust parameters for webcam and for streaming, you can set following options inside the configuration file, which is located in /etc/motion/motion.conf file:
    • stream_localhost. Whether streaming server is bound to localhost or to 0.0.0.0. Default is off.
    • stream_maxrate. Maximum framerate for stream streams. Default is 5.
    • stream_port. Port for camera stream (not for control panel). Default is 8081.
    • width. Width of the image to capture (applies for video as well). Default is 640.
    • height. Height of the image to capture (applies for video as well). Default is 480.
    • framerate. Maximum number of frames to be captured per second. Default is 15. Limit is 100.