阅读量:2
大致命令如下:
git clone --depth 1 git@github.com:ZLMediaKit/ZLMediaKit.git sudo apt-get install build-essential sudo apt-get install cmake #除了openssl,其他其实都可以不安装 sudo apt-get install libssl-dev sudo apt-get install libsdl-dev sudo apt-get install libavcodec-dev sudo apt-get install libavutil-dev sudo apt-get install ffmpeg cd ZLMediaKit vi .git/config cat .git/config mkdir build cd build #macOS下可能需要这样指定openss路径:cmake .. -DOPENSSL_ROOT_DIR=/usr/local/Cellar/openssl/1.0.2j/ cmake .. make -j4
.git/config文件修改后内容如下:
[core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [remote "origin"] url = git@github.com:ZLMediaKit/ZLMediaKit fetch = +refs/heads/master:refs/remotes/origin/master [branch "master"] remote = origin merge = refs/heads/master [submodule "ZLToolKit"] active = true url = git@github.com:ZLMediaKit/ZLToolKit [submodule "3rdpart/jsoncpp"] active = true url = git@github.com:open-source-parsers/jsoncpp.git [submodule "3rdpart/media-server"] active = true url = git@github.com:ireader/media-server [submodule "www/webassist"] active = true url = git@github.com:1002victor/zlm_webassist
运行服务
cd ../release/linux/Debug sudo systemctl stop nginx # MediaServer绑定了80端口,所以需要先停掉nginx sudo ./MediaServer -d &
注:服务器需开放554端口才能在本地访问到rtsp流
把mp4文件循环推给media server
ffmpeg -re -stream_loop -1 -i test.mp4 -vcodec h264 -acodec aac -f rtsp -rtsp_transport tcp rtsp://0.0.0.0/live/test
==========================
# 2024.02.23 补充MediaServer用docker来启动会更方便快捷:
docker run -id -p 1935:1935 -p 8080:80 -p 8443:443 -p 554:554 -p 8000:8000/udp zlmediakit/zlmediakit:master