UltronoArena TV https://ultronoarena.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

36 lines
976 B

#!/bin/bash
# render ultrono arena demos for twitch
name=${0##*/}
log=/opt/uatv/tmp/uatv_log
info () { printf '%s: %s: %s\n' "$name" "$$" "$1" | logger ; }
warn () { info "$1"; printf '%s: %s\n' "$name" "$1" >&2; }
quit () { warn "$1"; exit 1; }
# dependencies
read -r key < /opt/uatv/tv_keyfile
ffmpeg=$HOME/bin/ffmpeg
pids=/opt/uatv/pids
render () {
info "$(date -Iseconds) render function called"
nice -n 10 $ffmpeg -hide_banner -loglevel warning \
-f alsa -acodec pcm_f32le -r 48000 -i hw:Loopback,1,0 -f x11grab -i :0 -r 60 \
-f alsa -i hw:Loopback,1,1 \
-c:v libx264 -preset veryfast -b:v 6000k -maxrate 6000k \
-bufsize 6000k -pix_fmt yuv420p \
-filter_complex amix=inputs=2 \
-c:a libfdk_aac -b:a 192k -ac 2 -ar 44100 \
-f flv rtmp://live.twitch.tv/app/"$key" 2>> "$log" &
mpid=$!
warn "ffmpeg running at $mpid"
printf '%s\n' "$mpid" >> "$pids"
}
while true; do
render
while test -z "$mpid" || kill -0 "$mpid"; do
sleep 10
done
done