Now that the server is up and running, we need to SSH into the Raspberry Pi (or any computer with an USB webcam). Sending webcam audio and video to the NGINX server So you can choose between encrypted and unencrypted on all steps. The configuration also describes a SSL and a plain-text endpoint for each connection. Mind though that it only makes sense to use this authentication over SSL/TLS encryption, because the keys will be sent as plain text otherwise. It’s enough for the purpose of this article and for the most simple usage of media streaming. You can change this file as you see fit, just be sure to check the “Warnings” section of the repository documentation.Īs you can see on the nf, we have a rudimentar secret-key based authentication. Or better yet, take a look at the nf file: Check the repository documentation for more information on those ports. This will leave NGINX running attached to the 4080, 4443, 40 ports on the Docker host machine. The server is now ready to accept streams and to start broadcasting them. In case you want to do it manually for some reason you can follow the commands of the Dockerfile:įor you to set this container up, first clone the Docker image repository: This process is straight-forward but tedious, so I’ve built a Docker image to do that for us. However NGINX won’t support RTMP media stream by default, we’ll have to compile it with the RTMP module. This server is going to receive the media stream from the Raspberry Pi, decrypt it, authenticate and serve it as both HLS and Dash. The most important part of this setup is the NGINX server. But the biggest bottleneck I assume it’s NGINX processing the stream. In this article I’m going to demonstrate how I configured it all using common “of-the-shelf” tools, and I hope this helps you.īut before we begin, note that using this configuration I’m experiencing about 50 seconds of delay between what’s recorded and what’s played with all devices communicating over a 54mpbs Wifi network.
Whatever the use-case be, I have applied here simple but efficient methods to limit who can stream, who can watch and also to end-to-end encrypt everything.
Or something that’s designed to broadcast 24/7. Or anything that won’t match with some of the major streaming platform policies. This is useful if you’re willing to have any video source (file or live feed) streaming on the internet or network, maybe also host the stream on your own website (embedded as HTML) to display public events/places, all-sky-cameras, CCTV, science experiments, etc. Users will be able to watch the stream on the browser, Android, iOS, Linux, Windows and MacOS. Having an USB webcam connected to a Raspberry Pi 4, we’re going to use FFmpeg to securely (SSL and secret-key authentication) stream its video and audio (with CCTV-style timestamps) to a containerized NGINX server over RTMP/RTMPS protocol, and then use this same server to broadcast the stream to multiple users using both Apple HLS and MPEG-Dash.
Ffmpeg windows 10 webcam devices software#
Collateral Software fschuindt Streaming video and audio of an USB webcam to multiple users of a website with SSL, basic authentication and in-video timestamps (FFmpeg, RTMP, NGINX, HLS and MPEG-Dash)