Skip to content

Instantly share code, notes, and snippets.

@varvaruc
Forked from endolith/readme.md
Last active March 14, 2020 08:33
Show Gist options
  • Save varvaruc/d195c20c7a5fe83a24c62730d1f50c5a to your computer and use it in GitHub Desktop.
Save varvaruc/d195c20c7a5fe83a24c62730d1f50c5a to your computer and use it in GitHub Desktop.
How to stream a webcam to a web browser in Ubuntu

Grr this took hours to figure out. I was trying to install MJPG-streamer and running VLC command lines and all this crap but nothing worked.

First install motion:

~> sudo apt-get install motion

Then create a config file:

~> mkdir ~/.motion
~> nano ~/.motion/motion.conf

In it, the bare minimum to run a web server and view it on other computers:

stream_localhost off
stream_port 8081

webcontrol_localhost off
webcontrol_port 8080

Then run motion:

~> motion

Now you can view the webcam at http://hostname:8081 If it doesn't work, try rebooting between steps or something.

Isn't that easy? >:(

See also: How to run webcam software only when I am not home

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment