How to Setup Motion (WebCam Streaming) on the Raspberry Pi 3 Model B

it’s always good to start with :

sudo apt-get update
sudo apt-get upgrade

This just makes sure the system is up to date. Then you need to install the actual motion software

sudo apt-get install motion

then I had to change the permissions of a few files so that the pi user could read and write to them. I had seen that motion was going to create a new user for itself but as of today it’s running as the default user. I didn’t go out of my way to change that behavior since it appears to be the default now on a clean install.

sudo chown root:pi /etc/motion/motion.conf
sudo chown root:pi /var/lib/motion
sudo chown root:pi /tmp/motion.log
sudo chmod 774 /etc/motion/motion.conf
sudo chmod 774 /var/lib/motion
sudo chmod 774 /tmp/motion.log

if you’re having trouble try manually starting motion with

sudo motion

This will let you see the output from the startup and check to make sure video is coming through on port 8081. Also take a close look at the motion.conf file. It’s got tons of explanations of the¬†options and everyone’s setup will be a little different.

Once I changed all the permissions and testes just reboot the Pi to get the daemon up and running. It should start automatically from now on which makes it robust to power outages and disruptions.

Side note: My web cam is 1080 but the processor in the pi couldn’t really support more than 640 x 480 streaming resolution. Good luck!