Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Build a nginx+rtmp live broadcast server on Mac

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Open the terminal and install Homebrow

Ruby-e "$(curl-fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Second, install nginx

First clone nginx the project locally:

Brew tap denji/homebrew-nginx

Third, install Nginx

Brew install nginx-full-with-rtmp-module

Follow the prompts to:

Brew unlink nginx

The nginx and rtmp modules are installed in the above steps. Let's configure the rtmp module of nginx.

Check the information and find the location where nginx is installed

Brew info nginx-full

Location of nginx installation / location of usr/local/opt/nginx-full/bin/nginxnginx configuration file / location of usr/local/etc/nginx/nginx.confnginx server root / usr/local/var/www

V. start up

Sudo nginx

Error report:

Solution:

Find your nginx.conf folder directory and run a command similar to the following

Nginx-c / usr/local/etc/nginx/nginx.conf

Run sudo nginx again, and it will be fine.

The execution was successful.

Enter: http://localhost:8080 in the browser address bar (can be opened normally. Mine didn't open, but it didn't affect the back)

6. Open the configuration file nginx.conf

Nginx.conf under open / usr/local/etc/nginx

Under the http node:

Rtmp {server {listen 1935; application rtmplive {live on; max_connections 1024;} application hls {live on; hls on; hls_path / usr/local/var/www/hls Hls_fragment 1s;}

It's the same up there.

7. Then restart the configuration file

Sudo nginx-s reload

8. Install ffmepg tools

Brew install ffmpeg

It will take a little longer to install ffmpeg. If the speed is too slow, you can try a different mirror. While waiting, install a video player VLC that supports the rtmp protocol.

9. Ffmpeg push

The operation here is mac, a story.mp4 video of Download/ as an example, to execute the push command

Ffmpeg-re-I story.mp4-vcodec libx264-vprofile baseline-acodec aac-ar 44100-strict-2-ac 1-f flv-s 1280x720-Q 10 rtmp://localhost:1935/rtmplive/demo

10. After pushing the video to the server, open VLC, and then File- > open network- > enter:

Rtmp://localhost:1935/rtmplive/demo

After the push is over, the video will be gone.

Referred to a number of articles on the network.

PHP technical question and answer group. Learn and grow together.

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report