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

How to build a RTMP Live Server in docker

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

How to build a RTMP LVB server in docker? in view of this problem, this article introduces the corresponding analysis and solutions in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.

Environment building

Docker pull alfg/nginx-rtmp

Docker run-it\

-p 1935 purl 1935\

-p 8080VOG 80\

-- name nginx-rtmp\

-h nginx-rtmp\

Alfg/nginx-rtmp

Push stream

Go to this website https://obsproject.com/ to download obs and set the push URL to:

Rtmp://123.56.135.201:1935/stream

Watch the live broadcast

Put the code under the web server (not locally)

Var player = videojs ("hls-video")

Player.play ()

Nginx.conf

Daemon off

Error_log / dev/stdout info

Events {

Worker_connections 1024

}

Rtmp {

Server {

Listen 1935

Chunk_size 4000

Application stream {

Live on

Exec ffmpeg-I rtmp://localhost:1935/stream/$name

-libfdk_aac a libfdk_aac-b flv a 128k-c flv v libx264-b V2500k-f flv-g 30-r 30-s 1280x720-preset superfast-profile:v baseline rtmp://localhost:1935/hls/$name_720p2628kbs

-libfdk_aac a libfdk_aac-b preset superfast a 128k-c preset superfast v libx264-b flv v 1000k-f flv-g 30-r 30-s 854x480-preset superfast-profile:v baseline rtmp://localhost:1935/hls/$name_480p1128kbs

-libfdk_aac a libfdk_aac-b flv a 128k-c preset superfast v libx264-b flv v 750k-f flv-g 30-r 30-s 640x360-preset superfast-profile:v baseline rtmp://localhost:1935/hls/$name_360p878kbs

-libfdk_aac a libfdk_aac-b preset superfast a 128k-c preset superfast v libx264-b flv v 400k-f flv-g 30-r 30-s 426x240-preset superfast-profile:v baseline rtmp://localhost:1935/hls/$name_240p528kbs

-libfdk_aac a libfdk_aac-b flv a 64k-c flv v libx264-b flv v 200k-f V15-r 15-s 426x240-preset superfast-profile:v baseline rtmp://localhost:1935/hls/$name_240p264kbs

}

Application hls {

Live on

Hls on

Hls_fragment_naming system

Hls_fragment 5

Hls_playlist_length 10

Hls_path / opt/data/hls

Hls_nested on

Hls_variant _ 720p2628kbs BANDWIDTH=2628000,RESOLUTION=1280x720

Hls_variant _ 480p1128kbs BANDWIDTH=1128000,RESOLUTION=854x480

Hls_variant _ 360p878kbs BANDWIDTH=878000,RESOLUTION=640x360

Hls_variant _ 240p528kbs BANDWIDTH=528000,RESOLUTION=426x240

Hls_variant _ 240p264kbs BANDWIDTH=264000,RESOLUTION=426x240

}

}

}

Http {

Access_log / dev/stdout combined

Ssl_ciphers HIGH:!aNULL:!MD5

Ssl_protocols TLSv1 TLSv1.1 TLSv1.2

Ssl_session_cache shared:SSL:10m

Ssl_session_timeout 10m

Server {

Listen 80

# Uncomment these lines to enable SSL.

# Update the ssl paths with your own certificate and private key.

# listen 443 ssl

# ssl_certificate / opt/certs/example.com.crt

# ssl_certificate_key / opt/certs/example.com.key

Location / hls {

Types {

Application/vnd.apple.mpegurl m3u8

Video/mp2t ts

}

Root / opt/data

Add_header Cache-Control no-cache

Add_header Access-Control-Allow-Origin *

}

Location / live {

Alias / opt/data/hls

Types {

Application/vnd.apple.mpegurl m3u8

Video/mp2t ts

}

Add_header Cache-Control no-cache

Add_header Access-Control-Allow-Origin *

}

Location / stat {

Rtmp_stat all

Rtmp_stat_stylesheet static/stat.xsl

}

Location / static {

Alias / www/static

}

Location = / crossdomain.xml {

Root / www/static

Default_type text/xml

Expires 24h

}

}

}

This is the answer to the question about how to build a RTMP LVB server in docker. I hope the above content can be of some help to you. If you still have a lot of questions to solve, you can follow the industry information channel to learn more about it.

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

Internet Technology

Wechat

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

12
Report