Hello.
We use Kinescope a streaming platform, not YouTube, and we created a script for this:
cat ./ffmpeg
#!/bin/bash
COMANDO="/usr/bin/ffmpeg1"
while test $# -gt 0
do
T="$1"
echo =__=$T=__=;
if [[ "${T:32:57}" =~ ^([a-zA-Z0-9]+)-([a-zA-Z0-9]+)-([a-zA-Z0-9]+)-([a-zA-Z0-9]+)-([a-zA-Z0-9]+) ]]; then
COMANDO="$COMANDO $T"
elif [[ "${T:32:65}" =~ ^([a-zA-Z0-9]{32}) ]]; then
COMANDO="$COMANDO rtmp://rtmp-ru.kinescope.io/${T:32}"
elif [ "${T:0:32}" == "rtmp://a.rtmp.youtube.com/live2/" ]; then
COMANDO="$COMANDO rtmp://ovsu.mycdn.me/input/${T:32}"
# PRESET
# elif [ "$T" == "veryfast" ];then
# COMANDO="$COMANDO ultrafast"
# TIMEOUT
elif [ "$T" == "-y" ];then
COMANDO="$COMANDO -y"
# BITRATE
elif [ "$T" == "2976k" ];then
# COMANDO="$COMANDO 8000k -b 8000k -minrate 8000k"
COMANDO="$COMANDO 8000k"
# MAX BITARTE
elif [ "$T" == "5952k" ];then
COMANDO="$COMANDO 16000k"
# CBR
elif [ "$T" == "25" ];then
COMANDO="$COMANDO 18"
# FPS
# elif [ "$T" == "30" ];then
# COMANDO="$COMANDO 60"
# GOP
# elif [ "$T" == "60" ];then
# COMANDO="$COMANDO 120"
# AUDIO_DIFF
# elif [ "$T" == "pulse" ];then
# COMANDO="$COMANDO alsa"
# elif [ "$T" == "default" ];then
# COMANDO="$COMANDO plug:bsnoop"
elif [ "$T" == "1280x720" ]; then
COMANDO="$COMANDO 1920x1080"
elif [ "$T" == "1920x1080" ]; then
COMANDO="$COMANDO 2560x1440"
else
COMANDO="$COMANDO $T"
fi
shift
done
echo "Llamando a ffmpeg sustituyendo rtmp si hay: =$COMANDO=."
#echo $COMANDO
exec $COMANDO
PROCESO_FFMPEG=$!
echo "Esperando finalización del proceso: ${PROCESO_FFMPEG}."
wait $PROCESO_FFMPEG
This script run default ffmpeg named ffmpeg1.
At the first launch, logs are not written and an error occurs "Process ffmpeg hasn't written in 2 seconds, publishing periodic update".
When I restart the stream, everything works fine, but sometimes the CPU loads 100%.
What could be the reason?
Hello.
We use Kinescope a streaming platform, not YouTube, and we created a script for this:
This script run default ffmpeg named ffmpeg1.
At the first launch, logs are not written and an error occurs "Process ffmpeg hasn't written in 2 seconds, publishing periodic update".
When I restart the stream, everything works fine, but sometimes the CPU loads 100%.
What could be the reason?