Sign inSign up

zhaiweiwei/nginx-hls

By zhaiweiwei

•Updated almost 8 years ago

Image
0

993

zhaiweiwei/nginx-hls repository overview

Github https://github.com/zhaiweiwei/nginx-hls.git⁠

⁠使用说明

启动容器后,将mp4格式文件放入./media目录下,会自动切片,前提是已设置环境变量CONVERT_TOOL=True,你可以在启动容器时传入这个参数。 例如: 将demo.mp4文件放入./media目录下, 切片后的文件会保存在./media/hls/demo目录下,你可以通过http://localhost/hls/demo/demo.m3u8访问它。

⁠本镜像基于以下镜像构建
docker.io/centos:7.6.1810
⁠使用以下命令构建一个Image
docker build -t="nginx:hls" .
⁠使用以下命令运行容器
docker run --name nginx-rtmp -d -p 1935:1935 -p 80:80 nginx:rtmp
⁠将当前目录下的nginx.conf和媒体目录挂载到容器内
docker run --name nginx-hls \
    -d -p 1935:1935 -p 80:80 --restart=always \
    -v /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime \
    -v ${PWD}/nginx.conf:/usr/local/nginx/conf/nginx.conf \
    -v ${PWD}/media:/opt/media \
    -v ${PWD}/hls:/opt/hls \
    -v ${PWD}/live:/opt/live \
    -v ${PWD}/demo:/usr/local/nginx/html/demo \
    hub.cesinstitute.com.cn/public/nginx:hls
⁠示例(自动将.mp4格式文件转换为.m3u8)

将demo.mp4文件拷贝到media目录 cp demo.mp4 ${PWD}/media

通过以下路径访问转换后的视频 http://localhost/hls/demo/demo.m3u8

⁠本镜像开放以下端口
80      WEB端口
1935    rtmp流媒体服务端口

Tag summary

Content type

Image

Digest

Size

161.3 MB

Last updated

almost 8 years ago

docker pull zhaiweiwei/nginx-hls