ZLMediaKit Docker#
一个基于C++11的高性能运营级流媒体服务框架
WebRTC/RTSP/RTMP/HTTP/HLS/HTTP-FLV/WebSocket-FLV/HTTP-TS/HTTP-fMP4/WebSocket-TS/WebSocket-fMP4/GB28181/SRT server and client framework based on C++11
Docker#
docker run -id -p 1935:1935 -p 8080:80 -p 8443:443 -p 8554:554 -p 10000:10000 -p 10000:10000/udp -p 8000:8000/udp -p 9000:9000/udp zlmediakit/zlmediakit:master
docker run -id --name zlmediakit -p 1935:1935 -p 8080:80 -p 8443:443 -p 554:554 -p 10000:10000 -p 10000:10000/udp -p 8000:8000/udp -p 9000:9000/udp zlmediakit/zlmediakit:master
推流测试#
使用rtsp方式推流#
# h264推流
ffmpeg -re -i "/test.mp4" -vcodec h264 -acodec aac -f rtsp -rtsp_transport tcp rtsp://127.0.0.1/live/0
# h265推流
ffmpeg -re -i "/test.mp4" -vcodec h265 -acodec aac -f rtsp -rtsp_transport tcp rtsp://127.0.0.1/live/0
使用rtmp方式推流#
ffmpeg -re -i "/test.mp4" -vcodec h264 -acodec aac -f flv rtmp://127.0.0.1/live/0
# RTMP标准不支持H265,但是国内有自行扩展的,如果你想让FFmpeg支持RTMP-H265,请按照此文章编译:https://github.com/ksvc/FFmpeg/wiki/hevcpush
使用rtp方式推流#
# h264推流
ffmpeg -re -i "/test.mp4" -vcodec h264 -acodec aac -f rtp_mpegts rtp://127.0.0.1:10000
# h265推流
ffmpeg -re -i "/test.mp4" -vcodec h265 -acodec aac -f rtp_mpegts rtp://127.0.0.1:10000
播放测试#
RtspMediaSource
支持 rtsp播放、rtsp推流、webrtc播放、webrtc推流
rtsp://somedomain.com/live/0
rtsps://somedomain.com/live/0
rtsp://127.0.0.1/live/0?vhost=somedomain.com
rtsps://127.0.0.1/live/0?vhost=somedomain.com
RtmpMediaSource
支持 rtmp推流/播放、http-flv播放、ws-flv播放
rtmp://somedomain.com/live/0
rtmps://somedomain.com/live/0
rtmp://127.0.0.1/live/0?vhost=somedomain.com
rtmps://127.0.0.1/live/0?vhost=somedomain.com
HlsMediaSource
支持 hls播放
TSMediaSource
支持 http-ts播放、ws-ts播放
FMP4MediaSource
支持 http-fmp4播放、ws-fmp4播放
rtmp类型的流媒体源也支持http-flv、websocket直播,对应的url如下:
http://somedomain.com/live/0.live.flv
https://somedomain.com/live/0.live.flv
http://127.0.0.1/live/0.live.flv?vhost=somedomain.com
https://127.0.0.1/live/0.live.flv?vhost=somedomain.com
ws://somedomain.com/live/0.live.flv
wss://somedomain.com/live/0.live.flv
ws://127.0.0.1/live/0.live.flv?vhost=somedomain.com
wss://127.0.0.1/live/0.live.flv?vhost=somedomain.com
ZLMediaKit一般会把rtsp、rtmp流媒体源互相转换,也会转换成hls/http-ts/ws-ts/http-fmp4/ws-fmp4,播放的url如下:
HLS
http://somedomain.com/live/0/hls.m3u8
https://somedomain.com/live/0/hls.m3u8
http://127.0.0.1/live/0/hls.m3u8?vhost=somedomain.com
https://127.0.0.1/live/0/hls.m3u8?vhost=somedomain.com
HTTP-TS/WS-TS(后缀为
.live.ts
,目的是为了解决与hls的冲突)http://somedomain.com/live/0.live.ts
https://somedomain.com/live/0.live.ts
http://127.0.0.1/live/0.live.ts?vhost=somedomain.com
https://127.0.0.1/live/0.live.ts?vhost=somedomain.com
ws://somedomain.com/live/0.live.ts
wss://somedomain.com/live/0.live.ts
ws://127.0.0.1/live/0.live.ts?vhost=somedomain.com
wss://127.0.0.1/live/0.live.ts?vhost=somedomain.com
HTTP-fMP4/WS-fMP4(后缀为
.live.mp4
,目的是为了解决与mp4点播的冲突)http://somedomain.com/live/0.live.mp4
https://somedomain.com/live/0.live.mp4
http://127.0.0.1/live/0.live.mp4?vhost=somedomain.com
https://127.0.0.1/live/0.live.mp4?vhost=somedomain.com
ws://somedomain.com/live/0.live.mp4
wss://somedomain.com/live/0.live.mp4
ws://127.0.0.1/live/0.live.mp4?vhost=somedomain.com
wss://127.0.0.1/live/0.live.mp4?vhost=somedomain.com
合作项目#
可视化管理网站
流媒体管理平台
播放器