推流脚本
#!/bin/bash
serverName="localhost:1935"
basePath="/home/rocdean/nginx"
filePath="/tmp"
HLSPath="/hls"
while getopts :f opt
do
case $opt in
f) force=true;;
*) echo $opt not a option;;
esac
done
shift $[$OPTIND-1]
if [ $force ];then
rm -r $filePath$HLSPath$1
fi
if [ ! -d "$filePath$HLSPath$1" ] && [ ! -f "$filePath$HLSPath$1/index.m3u8" ];then
ffmpeg -re -i $basePath$1.mp4 -vcodec copy -vprofile baseline -acodec copy -f flv rtmp://$serverName$HLSPath$1
echo "#EXT-X-ENDLIST" >> $filePath$HLSPath$1/index.m3u8
else
echo "$filePath$HLSPath$1 OR $filePath$HLSPath$1/index.m3u8 is already exist."
fi
echo "finished~"
posted on 2017-12-04 19:51 后端bug开发工程师 阅读(213) 评论(0) 收藏 举报
浙公网安备 33010602011771号