archive
This commit is contained in:
37
MovieNight/entrypoint.sh
Executable file
37
MovieNight/entrypoint.sh
Executable file
@@ -0,0 +1,37 @@
|
||||
#! /bin/bash
|
||||
|
||||
function main() {
|
||||
listen &
|
||||
while true; do
|
||||
sleep 10
|
||||
publish
|
||||
done
|
||||
}
|
||||
|
||||
function listen() {
|
||||
if [ ! -d /main ]; then
|
||||
go build && ./MovieNight
|
||||
elif [ ! -e /main/exec-MovieNight ]; then
|
||||
/main/MovieNight
|
||||
else
|
||||
/main/exec-MovieNight
|
||||
fi
|
||||
kill -9 1
|
||||
}
|
||||
|
||||
function publish() {
|
||||
ffmpeg \
|
||||
-i rtsp://${RTSP_IP:-192.168.0.83}:${RTSP_PORT:-8554}/unicast \
|
||||
-preset ultrafast \
|
||||
-filter:v scale=-1:${RES:-720} \
|
||||
-vcodec libx264 \
|
||||
-acodec copy \
|
||||
-f flv \
|
||||
-b:v ${KBPS:-500}k \
|
||||
-b:a 0k \
|
||||
rtmp://localhost:1935/live/ALongStreamKey
|
||||
}
|
||||
|
||||
if [ "$0" == "$BASH_SOURCE" ]; then
|
||||
main "$@"
|
||||
fi
|
||||
Reference in New Issue
Block a user