How to disconnect video from my USB webcam to a remote HTML page

I want to create a program that will transfer video from a USB webcam via the Internet to a web page.

I am currently using a web service that, when launched, calls fswebcam to capture the image, save it to the data store, convert base64 to binary64 and send this data to an HTML page, where it is displayed in the 'src' of img attribute. The HTML page has JavaScript that calls this service once per second.

As you can tell, this is a terrible way to do this. I would rather have the right thread if I can. But I do not know what technologies are available for this.

The web service is written in nodeJS . The server runs on raspberry pi 2 . I did not ask this question in the raspberry pi forum because I think this is a common Linux/programming problem.

+10
stream video streaming webcam
source share
2 answers

The article here explains the whole process in the simplest way using working images. This is the Linux way to do this, not the node.js script. I declare the bulk of this here.

  • Connect to the Pi using the IP address. "pi" and "raspberry" are the standard "login as" and "password" in Raspbian.

  • To update the system type in the sudo apt-get update and sudo apt-get upgrade one.

  • Enter the command sudo apt-get install motion to start the installation.

  • Now, to make sure the camera is correctly detected, enter the lsusb command and enter. You should see the name of your camera. If it is NOT, then there is a problem in your camera or the camera is not supported in motion mode.

  • When the installation is complete, enter the command sudo nano/etc/motion/motion.conf and press enter.

  • Then you need to change some parameters in the .conf file. It can be difficult to find settings sometimes, but use Ctrl + W to find it. So, follow these steps:

    1. Make sure the daemon is turned on.
    2. Set the "frame rate" anywhere from 1000 to 1500.
    3. Keep "Stream_port" until 8081.
    4. "Stream_quality" must be 100.
    5. Change "Stream_localhost" to OFF.
    6. Change 'webcontrol_localhost' to OFF.
    7. Set the "quality" to 100.
    8. Set the "width" and "height" to 640 and 480.
    9. Set "post_capture" to 5.
    10. Press ctrl + x to exit. Enter y to save and enter to match.
  • Reissue the command sudo nano/etc/default/motion and press enter.

  • Set start_motion_daemon to yes. Save and exit.

  • First of all, you need to restart the motion software. To do this, enter the command sudo service motion restart and press enter.

  • Reissue the sudo motion command and press enter. Now your server is ready.

  • Now open your browser. Enter the IP address of your Raspberry Pi and port number as follows:

    192.168.0.107:8081 (First there is an IP address, then ":", then the port number). Press Enter.

Now you can see the live feed coming from your webcam directly to your laptop or mobile phone, or both at the same time. But this is a local connection. To make it public, configure your IP address publicly so that you can access it from anywhere in the world.

+1
source share

Use a framework like livecam .

Webcam Broadcast Modes Using GStreamer and Node.js

This module allows you to broadcast your webcam over a network that will be used by the yuor browser and / or transferred to a file. See the documentation for more information.

Application:

 // npm install livecam const LiveCam = require('livecam'); const webcam_server = new LiveCam({ 'start' : function() { console.log('WebCam server started!'); } }); webcam_server.broadcast(); 
0
source share

All Articles