Dev Notes Dev Notes
  • Home
  • Categories
  • Tags
  • Archives

How to stream webcam video on webpage

We will use Ubutu 14.04 in virtual box and MacOS as host.

Initial setup for guise OS (Ubuntu 14.04)

To have guvcview working we need stable version () Details could be found here Add ppa:

sudo apt-add-repository “deb http://ppa.launchpad.net/pj-assis/ppa/ubuntu trusty main”
sudo apt-get update

Install guvcview and moitoin:

sudo apt-get install guvcview
sudo apt-get install motion

Add config for motion (Details here and here):

mkdir ~/.motion
vim ~/.motion/motion.conf

Add following to motion.conf:

webcam_port 8081
webcam_localhost off

Initial setup for host OS (MacOS)

To have access to you camera in guies OS you need to enable it in VritualBox

From VBox command line:

VBoxManage list vms
VBoxManage list webcams
Video Input Devices: 2
.1 “Logitech Camera”
0x12200000046d081b
.2 “FaceTime HD Camera”
CC24553911QF6VVD1
VBoxManage controlvm “ubunut-dev” webcam attach /dev/video0

From VBox GUI:

webcams in vbox

VirtualBox Documentation

When finish check that webcam device is available in guest OS(Ubutu):

ls -la /dev/video*
crw-rw----+ 1 root video 81, 0 Jul 25 20:34 /dev/video0

Now we are ready to test. From terminal on Ubutnu run command:

guvcview

Check that camera is working

webcams in vbox

Testing streaming on web page. Run form terminal:

motion

And open url: http://localhost:8081/

You should see your video on page:

webcams in vbox

Sources:

PPA for guvcview

VirtualBox Documentation


Published

Jul 25, 2016

Last Updated

Jul 25, 2016

Category

HowTo

Tags

  • linux 1
  • ubuntu 2
  • video 1

Contact

  • Powered by Pelican. Theme: Elegant by Talha Mansoor