B
B
Be Clack2015-07-15 20:10:58
C++ / C#
Be Clack, 2015-07-15 20:10:58

How to properly create multiple broadcasts in Nginx RTMP?

Hello, I wanted to create several broadcasts ... More precisely, of different quality ... I did this in the config:

application lq {
                      live on;
                      record off;
                      allow publish 127.0.0.1;
                      allow publish 1.1.1.1;
                      deny publish all;
                      exec_pull ffmpeg -i 1.1.1.0 -c:v libx264 -profile:v baseline -b:v 500K -s 640x360 -f flv -c:a aac -ac 2 -strict -2 -b:a 256k rtmp://localhost/lq/$name;
              }
              
              application sd {
                      live on;
                      record off;
                      allow publish 127.0.0.1;
                      allow publish 1.1.1.1;
                      deny publish all;
                      exec_pull ffmpeg -i 1.1.1.0 -c:v libx264 -profile:v baseline -b:v 1500K -s 854x480 -f flv -c:a aac -ac 2 -strict -2 -b:a 256k rtmp://localhost/sd/$name;
                      exec_pull ffmpeg -i rtmp://localhost/sd/ -c copy -f flv rtmp://1.1.1.1/hls/stream;
              }	            

              application hd {
                      live on;
                      record off;
                      allow publish 127.0.0.1;
                      allow publish 1.1.1.1;
                      deny publish all;
                      exec_pull ffmpeg -i http://1.1.1.0 -c:v libx264 -profile:v baseline -b:v 4000K -s 1280x720 -f flv -c:a aac -ac 2 -strict -2 -b:a 256k rtmp://localhost/hd/$name;
              }

              application hls {
                            live on;
                            hls on;
                            hls_path /tmp/hls;
              hls_fragment 5s;
                            hls_base_url http://1.1.1.1/hls/;
              }

the video is taken from ip 1.1.1.0 via http
and the server converts and broadcasts to rtmp
There are three channels LQ, SD and HD
like everything is fine, but for example when you start nginx all three channels do not work stably. If, for example, SD broadcasts normally, then HD and LQ lose the picture, only the sound.
And sometimes the picture disappears for everyone and only the sound..
ubuntu server configs 14-
Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
16gm ram

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Saboteur, 2018-11-25
@AntonHerzen

1. Compilation - translation of text into executable code. Modern compilation is a complex process, now it includes both direct translation and linking to the final executable file (.exe, .com, *nix executable, etc.). Yes, the executable file is practically the machine code of the processor.
2. Compilation usually goes for a specific platform (roughly speaking, the processor), but in Java, for example, there is also a JIT compilation for the java machine itself. There is too much virtualization right now to make explicit statements.
3. The program has a difference. The compiler may have different optimization options. And the OC layer is made personally by you - for example, to draw windows, you can use the Windows libraries, and it's clear that they will work only under Windows. Or use a cross-platform framework thread, and then it will be under those platforms that the framework supports. Or stir up graphics from scratch, looking for how it is implemented for each platform. That is, you can write in C ++ depending on your knowledge of the platforms.
4. Different hardware provides different capabilities, but you must be able to work with it. If you want to use a GPU (video chipset) for mining, it is clear that the hardware must be with such a GPU.
If you are writing a simple program using standard libraries, there is no difference.

G
GavriKos, 2018-11-24
@GavriKos

1) In general, yes. You do not need more details yet
2) Both. It is compiled for a certain architecture into an executable file of the target OS using system calls of this OS
3) It makes a difference to the program if it uses at least something system. Or you can use universal "layers" a la Qt, which, depending on the compilation options, will substitute the necessary calls. Those. the console hello word can be written in such a way that it compiles both under tench and under Windows. Something complicated - you need to take into account the nuances or even make different implementations.
4) There is a difference. At the level of writing a program, these are the sizes of data types, the features of working with memory, and all that. At the run level - if the program is compiled for the wrong percentage - then it simply will not work.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question