-
-
Save nguyenvq/32dfe9b69352f5b057c911f762a25ec7 to your computer and use it in GitHub Desktop.
srs rtmp server with hls multiple bitrates
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
listen 1935; | |
max_connections 20; | |
daemon on; | |
pid /usr/local/srs/objs/srs.pid; | |
srs_log_tank file; # console; | |
srs_log_file /var/log/srs.log; | |
ff_log_dir /dev/null; | |
# can be: verbose, info, trace, warn, error | |
srs_log_level warn; | |
stats { | |
network 0; | |
disk sda vda xvda xvdb; | |
} | |
vhost __defaultVhost__ { | |
enabled on; | |
mix_correct on; | |
transcode live/stream { | |
enabled on; | |
ffmpeg /usr/local/bin/ffmpeg; | |
engine input { | |
enabled on; | |
iformat live_flv; | |
vfilter { | |
v quiet; | |
} | |
vcodec libx264; | |
vfps 25; | |
vwidth 512; | |
vheight 288; | |
vprofile main; | |
vpreset medium; | |
vparams { | |
crf 23; | |
x264-params keyint=50:min-keyint=25:scenecut=-1; | |
maxrate 650k; | |
bufsize 1300k; | |
refs 3; | |
c:a copy; | |
f flv; | |
y rtmp://stream-low/live/low; | |
c:v copy; | |
} | |
acodec copy; | |
oformat flv; | |
output rtmp://stream-high/live/high; | |
} | |
} | |
} | |
vhost stream-high { | |
enabled on; | |
hls { | |
enabled on; | |
hls_path /var/www/html; | |
hls_fragment 6; | |
hls_window 1800; | |
hls_cleanup on; | |
hls_dispose 0; | |
hls_m3u8_file live/high.m3u8; | |
hls_ts_file live/high-[seq].ts; | |
} | |
} | |
vhost stream-low { | |
enabled on; | |
hls { | |
enabled on; | |
hls_path /var/www/html; | |
hls_fragment 6; | |
hls_window 1800; | |
hls_cleanup on; | |
hls_dispose 0; | |
hls_m3u8_file live/low.m3u8; | |
hls_ts_file live/low-[seq].ts; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/hosts | |
... | |
127.0.1.2 stream-high.local stream-high | |
127.0.1.3 stream-low.local stream-low | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#EXTM3U | |
#EXT-X-VERSION:3 | |
#EXT-X-ALLOW-CACHE:YES | |
#EXT-X-MEDIA-SEQUENCE:0 | |
#EXT-X-TARGETDURATION:15 | |
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1300000,CODECS="mp4a.40.2,avc1.64001f",RESOLUTION=1024x576,NAME="1024" | |
live/high.m3u8 | |
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=650000,CODECS="mp4a.40.5,avc1.420016",RESOLUTION=512x288,NAME="512" | |
live/low.m3u8 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment