1. RTMP streaming media server construction

RTMP streaming media server construction


table of Contents

  1. Install srs streaming server
  2. Test srs streaming server
  3. Use OBS to push streaming

1. Install srs streaming media server (reference: RTMP distribution )

  1. srs官⽹:https://github.com/ossrs/srs
  2. The source code download speed of Code Cloud is fast: https://gitee.com/winlinvip/srs.oschina.git
  3. Download srs source code: git clone https://gitee.com/winlinvip/srs.oschina.git
  4. Enter the directory: cd srs.oschina/trunk
  5. Compile project (mac system): ./configure --osx && make
  6. Compilation success shows:Insert picture description here
  7. Configure srs, set max_connections in srs.conf to 200 (max_connections too large for mac systems will cause problems): vim conf/srs.conf
    Insert picture description here
  8. Configure srs and set max_connections in rtmp.conf to 200: vim conf/rtmp.conf
    Insert picture description here
  9. Start srs: ./objs/srs -c conf/rtmp.conf
  10. Check whether the startup is successful through the log: tail -f ./objs/srs.log , or query the status to determine whether the startup is successful: ./etc/init.d/srs status
    Insert picture description here

2. Test srs streaming media server

  1. Start the push stream encoder and use the FFMPEG command to push the stream: ffmpeg -re -i source.200kbps.768x320.flv -vcodec copy -acodec copy -f flv -y rtmp://192.168.16.39/live/livestream
    1. By default, the rtmp of srs uses the 1935 port. If the port is occupied or the port in srs.conf is modified, please adjust according to the situation; if the firewall is opened, check whether the 1935 port is allowed access.
    2. source.200kbps.768x320.flv: the flv video file to stream
    3. 192.168.16.39, the local ip, get the command: ifconfig| grep "inet"
      Insert picture description here
  2. Watch RTMP stream
    1. ffmpeg拉流:ffplay rtmp://192.168.16.39/live/livestream
    2. Play with online SRS player: srs-player
    3. VCL watch, download address: https://www.videolan.org/

3. Use OBS to push streaming

  1. The command style of ffmpeg is not very friendly. It is recommended to use the mainstream OBS open source streaming software. The latest version can be downloaded from the official website https://obsproject.com/ . In the past, many network anchors used it for live streaming. The software supports local video files and camera push streaming.
    Insert picture description here

1. File push

  1. Add "media source"
    Insert picture description here

  2. Import play files, such as flv files
    Insert picture description here

  3. Enter the settings, enter the server and streaming secret key (same as srs push above)
    Insert picture description here

  4. After setting, click to start streaming
    Insert picture description here

  5. To pull the stream: ffplay rtmp://10.235.1.252/live/livestream
    Insert picture description here

2. Camera push streaming

  1. It's almost the same as the previous one, the only difference is the addition of a "video capture device", which is not pretty...
    Insert picture description here
  2. Modify the streaming key to what you want to set
    Insert picture description here
  3. Start streaming
    Insert picture description here
  4. To pull the stream: ffplay rtmp://10.235.1.252/live/livestream1
  5. More settings for OBS: https://cloud.tencent.com/document/product/267/32726
    Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_41910694/article/details/110211406