I want to stream a USB camera connected to a raspberry pi 3 to a web-page(on different network). There are quite a few posts on this from 5-10 years ago, mostly using 'motion', which hasn't been updated in many years. Wondering if anyone has any suggestions for this now that it is 2020?

1 Answer 1


You'd first have to stream your camera to a site like YouTube. To do that you'd have to install FFmpeg on your Raspberry Pi.

Install FFmpeg:

sudo apt-get update
sudo apt-get install ffmpeg

Once you've got FFmpeg installed you'd have to create a Youtube account and verify it. Once you've verified your account you can go to the encoder setup in the video manager and note down your Server URL and Stream Key.

Then you'd have to run this in the terminal:

raspivid -o - -t 0 -vf -hf -fps 10 -b 500000 | ffmpeg -re -ar 44100 -ac 2 -acodec pcm_s16le -f s16le -ac 2 -i /dev/zero -f h264 -i - -vcodec copy -acodec aac -ab 128k -g 50 -strict experimental -f flv {Replace with server URL}/{Replace with Stream Key}

For more info: https://www.digikey.com/en/maker/blogs/streaming-live-to-youtube-and-facebook-using-raspberry-pi-camera

Once you get it on Youtube embedding it on an actual website is extremely easy.

The HTML element would look something like this:

<iframe width="560" height="315" src="https://www.youtube.com/embed/XYZ123" frameborder="0" allowfullscreen></iframe>

For more info: https://webcam.io/support/howto-embed-youtube-live/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.