Score:1

How can I HTTP stream a USB webcam plugged into my headless Ubuntu Server remotely?

us flag

I have a USB webcam plugged into my computer running Ubuntu Server at home. I want to access its video feed remotely.

I am connected to the server's network with a VPN, so I can SSH into it using something like ssh name@192.168.0.10, and can run commands this way.

I have tried many commands.

cvlc -I dummy -vvv v4l2:///dev/video0 will display the video feed in ascii in the terminal, so this tells us the webcam works.

How can I stream the results in HTTP for viewing in my browser when I am not at home?

ec flag
To make it easier to diagnose your issue, please edit your question to include the version of the Ubuntu OS that you're running.
Score:0
us flag

Using https://motion-project.github.io, I could create a simple config file, and do a standard reverse proxy using NGINX.

Here is my motion.conf file:

stream_quality 98
stream_maxrate 6
stream_port 1984     <------ required
stream_localhost off <------ required
output_pictures off
framerate 30
ffmpeg_video_codec mpeg
width 640
height 480
auto_brightness off
contrast 0
saturation 0

Here is my NGINX server

server {
    server_name DOMAIN;
    root /var/www/html;

    auth_basic "Admin"; # password protected domain
    auth_basic_user_file /etc/apache2/.htpasswd;

    location / {
        proxy_pass http://127.0.0.1:1984/;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Prefix /;
    }


    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/DOMAIN/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/DOMAIN/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.