Bobcares

NGINX RTMP Module Windows | Setup Guide

by | Jun 3, 2023

Let’s take a closer look at NGINX RTMP Module in Windows. At Bobcares, with our Server Management Service, we can handle your NGINX RTMP Module issues.

NGINX RTMP Module in Windows

Nginx RTMP is an Nginx module which allows you to add RTMP and HLS streaming to your media server. Previously, the RTMP and HLS modules were seperate Nginx modules, but now they are a single module on Nginx.

Steps to follow
  1. Firstly, download the nginx package.
  2. Then decompress the nginx_1.7.11.3 _Gryphon.zip, to get the Nginx_1.7.11.3_Gryphon folder.
  3. Then verify that Windows has unblocked all of the files so that we may run them.
  4. Be sure to look at the conf/nginx.conf file before running nginx.exe. Depending on the requirements or preferences, it could be necessary to alter parts of the content.
  5. Then use the command prompt to execute the command under the decompressed path.
    nginx.exe -v

    This command will display the NGINX version.

  6. Then, we create a new file called “nginx.conf” in the CONF directory of the NGINX 1.7.1.1.3 Gryphon folder.
  7. Enter the following information in nginx.conf, then save.
    Worker_processes 1; #nginx process number, recommended to be equal to the total number of CPU
    
    Events {
        Worker_connections 1024;#工 工作 工作 与
    }
    
    RTMP_AUTO_PUSH ON;
    
    #RTMP service
    RTMP {
        Server {
    Listen 1935;#service port
    CHUNK_SIZE 4096;#Data Transmission Block Size
    
    Application vod {
    Play./vod;#Video file storage location
    }
    Application Live {
    Live on;#Open live broadcast
    HLS ON;#Open HLS live. This parameter transforms live servers into real-time playback servers
    #Wait_Key on;#保护 视频 片 Slices, this will not produce mosaic
    HLS_PATH./M3U8FILE;#Slices Video File Storage Location (HLS, M3U8 file storage location)
    HLS_FRAGMENT 2S;#每 视频 片
    HLS_PLAYLIST_LENGTH 16S;
    Recorder mytribord {
    Record all manual;
    RECORD_SUFFIX _.FLV;
    RECORD_PATH./REC;
    }
    # hls_continuous on;#Continuous mode
    # hls_cleanup on;#多 多 切 切片
    #HLS_NESTED ON;#Nested mode
    }
    }
    }
    
    #Http service
    HTTP {
        Include mime.types;
        DEFAULT_TYPE Application/OCTET-stream;
        Sendfile on;
        Keepalive_Timeout 65;
    
        Server {
            Listen 80;
            Server_name localhost;
    
            Location/{
                Root HTML;
                Index index.html index.htm;
            }
    
            Location/Live_HLS {
    Types {
    # m3u8 Type settings
    Application/VND.Apple.mpegURL M3U8;
    #TS Split file settings
    VIDEO/MP2T TS;
    }
    # Point to access the M3U8 file directory
    Alias ​​./m3u8file;
    Add_header cache-control no-cache;#禁 缓 缓止
    }
    
            Location/Control {
    RTMP_CONTROL ALL;
    }
    
    Location/stat {
    RTMP_STAT ALL;
    RTMP_STAT_STYLESHEET STAT.XSL;
    }
    Location/stat.xsl {
    Root./nginx-rtmp-module-master;
    }
    
           #Redirect Server Error Pages to the static page/50x.html
            #
            Error_Page 500 502 503 504/50X.html;
            Location =/50X.html {
                Root HTML;
            }
        }
    }
    
  8. Then type the following command into the command prompt in the directory that contains Nginx.exe:
    nginx.exe -t

    This command’s purpose is to determine whether the NGINX configuration file is accurate. The configuration file nginx.conf is accurate when the information is output.

  9. By performing the above steps, we can confirm that the NGINX configuration file is correct before starting NGINX. Type the command into the command prompt  in the directory that contains nginx.exe:
    Start Nginx

Once the input is complete, enter the IP address of the machine hosting Nginx in the browser to show that Nginx has started successfully. Use the test-config.bat file to check for configuration errors each time you make a change to see if nginx picks them up. It is safe to (re)start Nginx if it detects no errors. If it does identify an error, it will inform us of it so we can quickly change the relevant setting before running test-config.bat once more.

Please make sure that OBS or any other live-streaming application is correctly configured before we test the setup. The live stream key should be “stream,” and the stream URL should be “rtmp:/localhost/live.”

We can create a stream and draw the test after launching NGINX. The act of transmitting data from the acquisition stage to the server is the “pushing through,” and in this case, the aaters pushed the locally acquired voice and video stream to the media server. It is the process of sending the site’s video signal to the network. The media file video3. Then push mp4 into nginx using FFMPEG and play it using VLC in the example below.

Run the following command in Windows command prompt:

ffmpeg -i video3.mp4 -f flv rtmp://127.0.0.1/live/test1

Pull Flow Test

Drawing alludes to the user’s end of the game, from the server to the client. We will use a video player like VLC to play the voice-over-video stream that Nginx passes through it. After following the instructions for the lightning described above, we launch VLC in Windows, click “Open Network Skestall,” and then click “Play.”

Then enter the network URL, rtmp://127.0.0.1/live/test1

The video screen can be seen in the VLC, proving that the draw was successful.

Play live state monitoring

We can download the nginx-rtmp-module-master.zip file here: https://github.com/arut/nginx-rtmp-module/. After it has been compressed, copy it to the directory: nginx 1.7.11.3 Gryphon.

Then in the file stat.xsl can then be found in the Nginx-RTMP-MODULE-MASTER directory. This merely matches the configuration settings in the nginx.conf configuration file.

Then we type http://127.0.0.1/stat into the browser. On the page, there is a live status monitor.

Issues and Precautions

  1. Firstly, start NGINX error. The NGINX installation path contains the root of the issue.
  2. Then use VLC to extract the video after that; it will be extremely blurry. We can solve this issue by changing the FFMPEG command, as shown below, and pulling the stream playback.
    ffmpeg -re -i video3.mp4 -vcodec h264 -Acodec copy -f flv rtmp://127.0.0.1/live/test1
  3. 1935 (RTMP service port) and 80 are the default ports for NGINX servers (HTTP port). Use the “NetStat -ano” command in the command prompt to check if the two ports have been used before starting NGINX and to make sure that no other programs are using them.
  4. Finally, it’s best to disable the firewall where the computer is located before launching NGINX.

[Looking for a solution to another query? We are just a click away.]

Conclusion

To conclude, our Support team went over the NGINX RTMP Module in Windows details along with its setup.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.