Video streaming Tutorial of sending processed Opencv video to NGINX and distributing video from NGINX (broadcast) by HLS stream for a wider audience, like multiple web players, VLC, or any other video stream receiver. Opencv application HLS streaming by GStreamer and NGINX We will use GStreamer to send video from the Opencv application by rtmp2sink to an RTMP module in NGINX. In our example, the server is a widely used NGINX server with an Nginx-RTMP-module. The NGINX will receive RTMP video from Opencv and restream as an HLS video stream considered for multiple end consumers. This is a follow-up to the previous article about Video streaming from Opencv to RtspSimpleServer by rtsp protocol. The goal is the same. Send video from Opencv to the server and restream the video for a wider audience. The difference is that RtspSimpleServer running on windows, NGINX is running in docker (WSL2). The one-to-one communication between Opencv and RtspSimpleServer was established by RTSP protocol
In Opencv 4.7 release notes, There is mentioned FFmpeg 5.x support improved. So let's compile FFmpeg 5.x from the source first and then Opencv 4.7 from the source with custom FFmpeg in Ubuntu. I did it last time with Opencv 4.6, I compiled FFmpeg and failed to build Opencv with FFmpeg enabled. So, I used apt-get install for FFmpeg and then build Opencv with FFmpeg without a problem. Final App, then links FFmpeg build from source as well as Opencv libs with FFmpeg support. Article here Today, Let's compile Opencv 4.7 with FFmpeg libs compiled from the source once again. Use ‘sudo’ in all commands if applicable. ;) Prerequisites to build FFmpeg The major source is FFmpeg Compilation Guide . If FFmpeg during the configuration complains, you have two options. Install the prerequisite or disable the option in the configuration. I installed approximately these prerequisites. sudo apt-get update -qq && sudo apt-get -y install \ autoconf \ automake \ build-essential \