Here's a simple mychan.png logo with transparent background made in GIMP.
What we want is to add logo on video that goes through nginx-rtmp. That can be done with the following ffmpeg overlay filter.
movie=/var/pictures/mychan.png[logo];[0][logo]overlay=0:70
Let's create a new application addlogo and add ffmpeg exec line to it. The result is published to myapp.
application myapp {
live on;
}
application addlogo{
live on;
exec ffmpeg -i rtmp://localhost/addlogo/$name
-vf "movie=/var/pictures/mychan.png[logo];[0][logo]overlay=0:70"
-c:v flv -f flv rtmp://localhost/myapp/$name;
}
Now start streaming sintel.
ffmpeg -re -i /var/video/sintel.mp4 -c:v flv -s 800x600 -c:a libfaac -ar 44100 -ac 1
-f flv rtmp://localhost/addlogo/mystream
Here's the result.
[...] « Placing logo on video [...]
ReplyDeleteAm I right to think that the speed of processing in this case, to ffmpg will be approximately equal to the length of the video?
ReplyDeleteSpeed completely depends on ffmpeg. Decoding & encoding is the slowest part of that.
ReplyDeleteHi! thank you for your work.
ReplyDeleteI've a question : the quality of the video with the logo is lower than without.
I suppose it's because of the compression, but is there a solution ?
It will always be lower. The solution is to set better h264 encoding options.
ReplyDeleteLOGO PNG image format is the right choice. Good jpg to png image conversions at jpg4png.com help soft quality images. more optimized <here>
ReplyDeletei can add realtime alert from twitch to rtmp app ?
ReplyDelete