I've been trying to overlay an image on a rtmp stream and resend it to Facebook Live and Twitch, using a nginx with a rtmp module and ffmpe. I have used this code for each service:
ffmpeg -i rtmp://localhost/app/streamkey -i logo.png -filter_complex "[0:v][1:v] overlay=0:0" -c:v libx264 -preset veryfast -bufsize 4000k -c:a aac -b:a 160k -ar 44100 -f flv rtmp://live-api.facebook.com:80/rtmp/streamkey;
I have one command for Facebook Live and another for Twitch, but it consumes much hardware, so looking around I found a work around using tee seudo-mixer:
ffmpeg -i rtmp://localhost/app/streamkey -i logo.png -filter_complex "[0:v][1:v]overlay=10:10" -c:v libx264 -preset veryfast -bufsize 4000k -c:a aac -b:a 160k -ar 44100 -f tee "[f=flv]rtmp://live-api.facebook.com:80/rtmp/streamkey|[f=flv]rtmp://live-jfk.twitch.tv/app/streamkey"
It works fine with Facebook Live, but when Twitch starts the live streaming there is no image, only a black screen.
What am I doing wrong, and how do I get this stream working?
Map all streams expressly and for FLV, global headers are required.
ffmpeg -i rtmp://localhost/app/streamkey -i logo.png -filter_complex "[0:v][1:v]overlay=10:10[v]" -map "[v]" -map 0:a? -c:v libx264 -preset veryfast -bufsize 4000k -c:a aac -b:a 160k -ar 44100 -flags +global_header -f tee "[f=flv]rtmp://live-api.facebook.com:80/rtmp/streamkey|[f=flv]rtmp://live-jfk.twitch.tv/app/streamkey"