Third, use FFMPEG + NGINX + RTMP under Windows to build a live stream, draw

One. Environment

1. Development environment: windows

2. Development tools: FFmpeg, nginx, nginx-rmtp-module

(Link: https://pan.baidu.com/s/119d2GeMzddas_wEsBdeInw Extraction code: lxmp)

3. Introduction: Nginx is a lightweight web server/reverse proxy server and email (IMAP/POP3) proxy server. Nginx-rmtp-module is a streaming plug-in for Nginx server. Nginx provides rtmp service through the rtmp module, ffmpeg pushes a rtmp stream to nginx, and then the client accesses nginx to watch the real-time video stream.

Two. Prepare files

Nginx, nginx-rmtp-module, FFmpeg and example mp4 video

share picture

Three, build practice

1, start nginx server

Share pictures

1, enter windows cmd

2, cd nginx -1.7.11.3-Gryphon //Enter the nginx directory

3, nginx.exe -c conf
ginx-win-rtmp.conf //Run the rtmp configuration file

Note: At this time, the command line will always be in execution. Don’t bother about it or close it.

Test: enter localhost:80 in the browser, if the following page appears, it means that the configuration of nginx has started successfully!

Share pictures

2. Configure FFmpeg

Share Picture

1, decompression: decompress ffmpeg to the specified directory, here is D: fmpeg

Share a picture

2. Environment configuration: Right click my computer ( Win10 is this computer) –> Properties –> Advanced System Settings –> Advanced –>Environment Variables –> Open Path,

Change D: fmpeg fmpegin (your ffmepg The absolute path of the bin directory in the decompression directory) is added to the Path path; Baidu if the specific method is not available

3. Test : Open the cmd of windows (don’t close the previous nginx) and enter ffmpeg -help. If the following situation occurs, the configuration is successful

share picture

Operation by elevation:

Share pictures

share picture

three , Run

1. Put the downloaded orange.mp4 file in the D: fmpeg directory folder of the D drive.

2. Open the cmd of windows newly (don’t close the previous ngnix) and enter the folder in the D: fmpeg directory.

3. Then enter the command:

ffmpeg -re -i orange.mp4 -vcodec libx264 -acodec aac -f flv rtmp://Your ip address: 1935/live/home

//Note: 192.168.1.140 is the ip address of my computer, Need to be replaced with your ip address (ip address can be obtained through cmd's ipconfig command)
//For example: ffmpeg -re -i orange.mp4 -vcodec libx264 -acodec aac -f flv rtmp://192.168.1.140:1935/live /home

share picture

Share a picture

4. Open the vlc player on the computer Enter the address: rtmp ://Your ip address:1935/live/home

share picture< /p>

Share a picture

Share a picture

5, then click the command line to enter and then click play, and then you will see this at the beginning of the article The picture is complete!

share picture

 ffmpeg -re -i orange.mp4 -vcodec libx264 -acodec aac -f flv rtmp://you Ip address: 1935/live/home

//Note: 192.168.1.140 is the ip address of my computer, Need to be replaced with your ip address (ip address can be obtained through cmd's ipconfig command)
//For example: ffmpeg -re -i orange.mp4 -vcodec libx264 -acodec aac -f flv rtmp://192.168.1.140:1935/live /home

Leave a Comment

Your email address will not be published.