It all started with the fact that, with the help of OBS Studio and some program for animating desktop wallpapers, they made a videologue from the logo (which also animated under the current playing music). At that moment, I realized that OBS Studio can MUCH more than just stream games. After a closer acquaintance with OBS Studio, she claims to be the coolest program I've ever met .
I had to stream a small event for friends, but since I have the equipment for good sound and the desire to do cool, I was puzzled by the organization of the stream with a separate sound and several cameras. Stream for various reasons turned out to be so myself, but after this experience, I would seem to imagine how it should be. And I want to share. Here it is.
The idea is to find 2-3 wireless operators who go to different venues of the event, communicate with people, shoot traffic, etc. (well, like serious guys, in short). And someone is sitting, communicating with them on the radio, and from all of this (and something else, for example, all kinds of windows / monitors / projectors of restraint) forms interesting video content that is not boring to watch.
It is also possible to combine the screens of several computers into one stream, perhaps this may be useful for games. Although most likely specifically for this task there are other technologies.
Because it allows you to do very cool and greatly shift the technological ceiling of the quality of the stream almost for nothing.
When using heaps of video streams, the coolness of the stream will be determined by the creative and organizational component (well, the quality of the connections).
If there is something else, you can make a good sound, at least on stationary cameras (which can be any relatively high-quality webcam).
And if there is another computer on Linux (they say, even Raspberry Pi is ok for ≤3 threads), you can slightly unload the main computer and its network to process and send the stream.
Conventional protocol for video streaming - RTMP . Attempts to use something else lead to wild lags, it was my main mistake.
In fairness, it is worth noting the proprietary technology NewTek NDI (thanks, Alexsey ), which is kind of cooler than RTMP. However, for our juz-case, the use of NDI will require a lot of extra money.
It turns out that taking an RTMP stream and redirecting it to OBS Studio is a snap. You just need to compile nginx with a custom module and write the config. But more about that later.
In an amicable way, you have to do something like this:
That is, do not give mobile phones the Internet so that they do not spend resources on anything other than stream.
But if a good Wi-Fi with the Internet is already there (and there is no extra access point on 5GHz), then you can not disdain and use existing connections. However, it is still desirable to send the final stream from another connection, or, in extreme cases, from the same, but through a wire.
If there is a need to receive streams from cameras and send the final stream through the same Wi-Fi, carefully test stability (and note that it will decrease greatly if a crowd of devices get into this Wi-Fi).
It is better to do this on Linux, so as not to have problems with all sorts of MINGW / MSYS. And on a separate hardware (not necessarily powerful). Either in docker, then you can skip this section, because there is already a pre-file . It is also possible through WSL , but it will be necessary to manually forward TCP port 1935 in the firewall.
Here's a great manual: a RTMP server using nginx , and the dock is also validly written. A brief retelling in freestyle:
We put dependences:
sudo apt install build-essential libpcre3 libpcre3-dev libssl-dev
We download the latest Mainline version of the source from here :
wget http://nginx.org/download/nginx-1.15.2.tar.gz # Check for newer versions tar xzf nginx-* && cd !$
Downloading the latest version of the RTMP module :
wget https://github.com/arut/nginx-rtmp-module/archive/master.zip -O rtmp-module.zip unzip !$ -d .
Create a Makefile:
./configure --with-http_ssl_module --add-module=./nginx-rtmp-module-master
If it falls down before reaching the Configuration summary
, we fix the problems.
This command will set up your streamer nginx live in /usr/local/nginx/
and run with the command sudo /usr/local/nginx/sbin/nginx
. Thus, nginx from the repository will not feel anything. This can be changed by examining ./configure --help
.
Compile:
make -j4
Install:
echo "nginx with RTMP module" > description-pak sudo checkinstall --pkgname nginx-rtmp --provides nginx --nodoc --deldesc -y sudo mkdir /usr/local/nginx/logs/ # Doesn't start without it
In principle, through make install
is safe in this case, but still not necessary .
Check
$ /usr/local/nginx/sbin/nginx -v nginx version: nginx/1.15.2
Customize
sudo vim /usr/local/nginx/conf/nginx.conf
At the end we add the config of the RTMP server:
rtmp { server { listen 1935; application live { live on; record off; } } }
If desired, you can configure the HTTP server to display statistics .
The dock describes what else can be customized, there really is a lot of things. If you know how to do better, I will be happy to add a section about server configuration with material from comments.
Make it convenient
alias rtmp-start="sudo /usr/local/nginx/sbin/nginx" alias rtmp-stop="sudo /usr/local/nginx/sbin/nginx -s stop" alias rtmp-status="cat /usr/local/nginx/logs/nginx.pid"
Send a stream from the mobile app to rtmp://< IP>:1935/live/habr
where live
is the name of the RTMP application in the nginx config, and habr
is the Stream Key , which needs to be changed for different cameras.
If you have configured the display of statistics (and did not forget to change the path to the stat.xsl
file), check that the stream came (at http: // localhost: 8080 / stat ).
Connect to all streams OBS Studio.
PROFIT !!!
Obviously, the server can be not only local, but also accessible from the external one, which will allow you to do the same, but not via Wi-Fi, but via the Internet. You can make your analog of Instagram group streams, well, in general, limitless possibilities))
There are a couple of things that I learned from mistakes and would like to share:
Now everything is exactly, thank you for your attention ^ _ ^
For those who try to still knock out nginx for the ubiquitous Venda, here’s the rake I walked through, it still turned out to be a quest, I was not afraid of this process in vain:
src\os\win32
folder in the archives from the site. If you have the source from the site, there will be an error don't know how to make 'src/os/win32/ngx_win32_config.h'
.mingw-developer-toolkit
you need to uncheck the Perl checkbox. Perl has to be screw.rc.exe
from %ProgramFiles(x86)%\Windows Kits\10\bin\10.0.16299.0\x64
, you need to add this folder manually in PATH-WX
flag from CFLAGS
in the Makefile so that the vornings do not interrupt the compilation, there are vornings in 1.15.3 ...So I did something like this:
#cmd: "%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" #cmd: set PATH=%PATH%;%ProgramFiles(x86)%\Windows Kits\10\bin\10.0.16299.0\x64 #cmd: C:\MinGW\msys\1.0\msys.bat #bash: cd nginx-1.15.3 ./auto/configure \ --with-cc=cl \ --with-debug \ --prefix= \ --conf-path=conf/nginx.conf \ --pid-path=logs/nginx.pid \ --http-log-path=logs/access.log \ --error-log-path=logs/error.log \ --sbin-path=nginx.exe \ --http-client-body-temp-path=temp/client_body_temp \ --http-proxy-temp-path=temp/proxy_temp \ --http-fastcgi-temp-path=temp/fastcgi_temp \ --http-scgi-temp-path=temp/scgi_temp \ --http-uwsgi-temp-path=temp/uwsgi_temp \ --with-cc-opt=-DFD_SETSIZE=1024 \ --with-pcre=objs/lib/pcre-8.42 \ --with-zlib=objs/lib/zlib-1.2.11 \ --with-openssl=objs/lib/openssl-1.1.1 \ --with-openssl-opt=no-asm \ --with-select_module \ --with-http_ssl_module \ --add-module=nginx-rtmp-module-master nmake
Source: https://habr.com/ru/post/420037/
All Articles