Placing logo on video

It’s really great to be able to add logo on your video. Here’s a simple guide how to do that with ffmpeg and set up nginx-rtmp to add logo automatically.

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.


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.

  1. #1 by Vasya Vasyaa on February 21, 2013 - 5:40 am

    Am I right to think that the speed of processing in this case, to ffmpg will be approximately equal to the length of the video?

    • #2 by rarut on February 21, 2013 - 5:56 am

      Speed completely depends on ffmpeg. Decoding & encoding is the slowest part of that.

  2. #3 by kpetrem on June 13, 2013 - 9:45 pm

    Hi! thank you for your work.

    I’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 ?

    • #4 by rarut on June 14, 2013 - 4:51 am

      It will always be lower. The solution is to set better h264 encoding options.

  1. Picture in picture « rarut

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: