video – FFMPEG to Youtube Live – Stack Overflow
After a lot of trial and error the solution below works pretty much perfectly. To make sure it runs 24/7 wrap it inside a service of some description.
This is with an up to date version of FFMPEG to include -stream_loop -1.
The background is an mp4 file.
http://localhost:3888
= an audio stream.ffmpeg -stream_loop -1 -i $MYPATH/background/$background \ -i http://localhost:3888 -filter:a "volume=$volume" \ -r 24 -g 48 -pix_fmt yuv420p -x264-params keyint=48:min-keyint=48:scenecut=-1 \ -s $size -b:v $bitrate -b:a 128k -ar 44100 -acodec aac \ -vcodec libx264 -preset superfast -bufsize 960k -crf 28 -threads 2 \ -f flv rtmp://a.rtmp.youtube.com/live2/$key
Config File:
# Config File background=out.mp4 size=1280x720 bitrate=1500k key=----KEY---- volume=0.5