In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "how to build a nginx+rtmp live broadcast server on Mac". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to build a nginx+rtmp live broadcast server on Mac".
First, install homebrow
Those who already have brow installed can skip this step.
Execute a command
Ruby-e "$(curl-fssl https://raw.githubusercontent.com/homebrew/install/master/install)"
If you have already installed and want to uninstall:
Ruby-e "$(curl-fssl https://raw.githubusercontent.com/homebrew/install/master/uninstall)"
Second, install nginx
First glone nginx the project locally:
Brew tap homebrew/nginx
Perform the installation:
Brew install nginx-full-with-rtmp-module
The installation process is slow. Wait patiently.
The nginx and rtmp modules are installed by following the steps above. Let's configure the rtmp module of nginx.
First of all, let's see where our nginx is installed.
Brew info nginx-full
After executing the above command, we can see the message.
Location of nginx installation
/ usr/local/cellar/nginx-full/1.10.1/bin/nginx
Location of the nginx configuration file
/ usr/local/etc/nginx/nginx.conf
3. Run nginx
Execute the command to test whether the nginx service can be started successfully
Nginx
The command line is shown in the following figure
Enter: http://localhost:8080 in the browser address bar (click directly)
If it appears
Welcome to nginx!.03
It means that nginx is installed successfully.
If prompted on the terminal
Nginx: [emerg] bind () to 0.0.0.0 bind 8080 failed (48: address already in use)
It means 8080.
Port is occupied. Check port pid.
Lsof-I tcp:8080
Kill drops the pid that occupies port 8080
Kill 9603 (here replaced by pid that occupies port 8080)
Then re-execute the nginx
Common method of nginx: reload configuration file
Nginx-s reload
Reload the log:
Nginx-s reopen
/ / stop nginx
Nginx-s stop
/ / exit nginx in an orderly manner
Nginx-s quit
4. Configure rtmp
Now let's modify the configuration file nginx.conf to configure rtmp
Copy the location of the nginx configuration file
/ usr/local/etc/nginx/nginx.conf
Open finder shift + command + g to go and open nginx.conf with notepad tool
Http {. }
Add the rtmp configuration after the http node:
Rtmp {server {listen 1935; # LVB stream configuration application rtmplive {live on; # sets the maximum number of connections for the rtmp engine. Default is off max_connections 1024;} application hls {live on; hls on; hls_path / usr/local/var/www/hls; hls_fragment 1s;}
Install ffmepg tools
Brew install ffmpeg
You need to wait a while to install this, and then prepare a video file for push, and then we install a video player that supports rtmp protocol. You can use vlc under mac.
Vlc.04
The following figure shows that ffmpeg has been installed.
Ffmpeg installation completed 0.5
6. After the installation of ffmepg, you can start to push streams.
Ffmpeg-re-I absolute path to your video file (e.g. / users/lideshan/downloads/demo.mp4)-vcodec copy-f flv rtmp://localhost:1935/zbcs/room// such as: ffmpeg-re-I / users/jiangys/documents/document/demo.mp4-vcodec copy-f flv rtmp://localhost:1935/zbcs/room
Here zbcs is the path name of the configured application in the configuration file above; the following room can be written as you like.
Push interface:
7. Verify the video
Then open the vlc player software on the computer and click file---- > open network. Select network in the pop-up box and type url:
Rtmp://localhost:1935/zbcs/room
Double-click to play
Playback interface
Error reporting processing
When the 1.ffmepg command pushes the stream, it prompts that the connection failed. [tcp @ 0x7ff162504b60] connection to tcp://localhost:1935 failed (connection refused), trying next address
This error occurs because nginx needs to be restarted after nginx.conf is configured. Enter the command to restart and there will be no problem.
Nginx-s reload
two。 After installing nginx, enter "display does not open the web page" in the browser address bar
Solution: due to the installation of the nginx server, it sometimes takes a few minutes to take effect. If it does not take effect, test whether the nginx service can be started successfully, and command
Nginx, thank you for your reading. The above is the content of "how to build a nginx+rtmp LVB server on Mac". After the study of this article, I believe you have a deeper understanding of how to build a nginx+rtmp LVB server on Mac, and the specific usage needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.