arut / nginx-rtmp-module

NGINX-based Media Streaming Server
http://nginx-rtmp.blogspot.com
BSD 2-Clause "Simplified" License
13.5k stars 3.52k forks source link

Can we add Logo/Watermark without FFMPEG? #1542

Open shelomito12 opened 4 years ago

shelomito12 commented 4 years ago

I was thinking if it is possible to add a new directive like logo_path that affects all push directives:

application myapp {
            live on;
            logo_path /path/to/file/logo.png;
            push rtmp://127.0.0.1:1936/rtmp/live1;
            push rtmp://127.0.0.1:1936/rtmp/live2;
            push rtmp://127.0.0.1:1936/rtmp/live3;
            }

or worst case, can this work using ffmpeg https://stackoverflow.com/questions/61998020/cant-get-watermark-on-my-nginx-rtmp-live-streams-with-ffmpeg/62748610#62748610 ?

entonbiba commented 4 years ago

its cpu intensive using ffmpeg, but you can add a logo to the top right corner this way:

exec_push ffmpeg -i rtmp://127.0.0.1:1936/rtmp/myapp -c:v libx264 -c:a copy -b:v 1920k -vf "movie=/home/logo.png[logo];[0][logo]overlay=main_w-overlay_w-20:20" -preset ultrafast -crf 10 -g 50 -r 19 -maxrate 1920k -bufsize 960k -x264opts keyint=50:min-keyint=50:scenecut=-1 -f flv rtmp://127.0.0.1:1936/rtmp/live1