ffmpeg -listen 1 -i rtmp://127.0.0.1:5555 -c copy -f flv rtmp://twitch -c:v libx264 -preset medium -maxrate 3500k -bufsize 6000k -r 30 -pix_fmt yuv420p -g 60 -c:a aac -b:a 160k -ac 2 -ar 44100 -f flv rtmp//:facebook
Don't use
-re
with live input streams. Documentation says that it may cause packet loss.I changed
-g 50
to-g 60
to better fit your 30 fps.See the fifo muxer if you want to add options to attempt to recover the output in case of failure.