Showing posts with label usb. Show all posts
Showing posts with label usb. Show all posts

Sunday, May 1, 2016

How to setup raspberry pi with usb camera for streaming video

Found a lot of articles about how to setup USB Camera with raspberry Pi for streaming video. Everything went fine for except one thing, stream stops after 5-10 seconds. Camera indicator still on, but browser stops showing updates, just frozen picture. The problem was that by default motion saves video and snapshots to /var/lib/motion/ directory. And looks like motion doesn't have enough permissions to write into it. So the fix is very easy: sudo chmod 77 /var/lib/motion.

Configuration:
Raspberry Pi3, USB Camera Logictech C300, micro SD 4Gb

How to install motion:

  • sudo apt-get update
  • sudo apt-get upgrade
  • sudo apt-get install motion

In order to enable remote access and deamon, change these params: 

  • webcam_localhost off
  • daemon on

sudo nano /etc/motion/motion.conf

To setup daemon, open
sudo nano /etc/default/motion
and set start_motion_daemon=yes

Now you start and stop service by using these commands:
  • sudo service motion start
  • sudo service motion stop
If camera is on and off, everything is set and running. 
Camera can be access remotely via <raspberryIP_address>:8081

Motion FQA can be found here