FFMPEG: how to add watermark to video?











up vote
0
down vote

favorite












My Platform: Ubuntu 10.10 + FFMPEG 0.5.3(I installed ffmpeg from source)



I try to add Watermark to a .MOV video with FFMPEG 0.5.3 imlib2.so (Please note FFMPEG 0.6+ dont support imlib2.so, so I use ffmpeg 0.5.3)



Here is my code:



ffmpeg -sameq -i example.mov -vhook '/usr/local/lib/vhook/imlib2.so -x 0 -y 0 -i /var/www/files/watermark.png' newexample.mov



Here is the output:



FFmpeg version 0.5.3, Copyright (c) 2000-2009 Fabrice Bellard, et al.
configuration: --enable-avfilter --enable-filter=movie --enable-avfilter-lavf
libavutil 49.15. 0 / 49.15. 0
libavcodec 52.20. 1 / 52.20. 1
libavformat 52.31. 0 / 52.31. 0
libavdevice 52. 1. 0 / 52. 1. 0
libavfilter 0. 4. 0 / 0. 4. 0
built on Jul 3 2011 12:05:08, gcc: 4.4.5

Seems stream 1 codec frame rate differs from container frame rate: 59.94 (5994/100) -> 29.97 (30000/1001)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'example.mov':
Duration: 00:03:14.06, start: 0.000000, bitrate: 3350 kb/s
Stream #0.0(eng): Audio: aac, 48000 Hz, stereo, s16
Stream #0.1(eng): Video: h264, yuv420p, 1150x647, 29.97 tbr, 29.97 tbn, 59.94 tbc
Output #0, mov, to 'newexample.mov':
Stream #0.0(eng): Video: mpeg4, yuv420p, 1150x647, q=2-31, 200 kb/s, 90k tbn, 29.97 tbc
Stream #0.1(eng): Audio: 0x0000, 48000 Hz, stereo, s16, 64 kb/s
Stream mapping:
Stream #0.1 -> #0.0
Stream #0.0 -> #0.1
Unsupported codec for output stream #0.1


What could be the possible problem? Is that AAC or H264 that is not supported?



I installed libavcodec-extra-52, linfaac, libfaad and etc. but the error is the same.



Do I have to install following this instruction? HOWTO: Install and use the latest FFmpeg and x264 or there is a simpler solution?










share|improve this question
























  • If you fixed your own question, put the solution in an answer of its own.
    – Wuffers
    Jul 9 '11 at 22:09










  • @Mark Szymanski Where did he give any impression that he "fixed"/solved his own question?
    – barlop
    Jul 10 '11 at 11:32










  • @barlop: if you look at the revisions, you will see that he posted and update to his question which include an answer.
    – Wuffers
    Jul 10 '11 at 13:09















up vote
0
down vote

favorite












My Platform: Ubuntu 10.10 + FFMPEG 0.5.3(I installed ffmpeg from source)



I try to add Watermark to a .MOV video with FFMPEG 0.5.3 imlib2.so (Please note FFMPEG 0.6+ dont support imlib2.so, so I use ffmpeg 0.5.3)



Here is my code:



ffmpeg -sameq -i example.mov -vhook '/usr/local/lib/vhook/imlib2.so -x 0 -y 0 -i /var/www/files/watermark.png' newexample.mov



Here is the output:



FFmpeg version 0.5.3, Copyright (c) 2000-2009 Fabrice Bellard, et al.
configuration: --enable-avfilter --enable-filter=movie --enable-avfilter-lavf
libavutil 49.15. 0 / 49.15. 0
libavcodec 52.20. 1 / 52.20. 1
libavformat 52.31. 0 / 52.31. 0
libavdevice 52. 1. 0 / 52. 1. 0
libavfilter 0. 4. 0 / 0. 4. 0
built on Jul 3 2011 12:05:08, gcc: 4.4.5

Seems stream 1 codec frame rate differs from container frame rate: 59.94 (5994/100) -> 29.97 (30000/1001)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'example.mov':
Duration: 00:03:14.06, start: 0.000000, bitrate: 3350 kb/s
Stream #0.0(eng): Audio: aac, 48000 Hz, stereo, s16
Stream #0.1(eng): Video: h264, yuv420p, 1150x647, 29.97 tbr, 29.97 tbn, 59.94 tbc
Output #0, mov, to 'newexample.mov':
Stream #0.0(eng): Video: mpeg4, yuv420p, 1150x647, q=2-31, 200 kb/s, 90k tbn, 29.97 tbc
Stream #0.1(eng): Audio: 0x0000, 48000 Hz, stereo, s16, 64 kb/s
Stream mapping:
Stream #0.1 -> #0.0
Stream #0.0 -> #0.1
Unsupported codec for output stream #0.1


What could be the possible problem? Is that AAC or H264 that is not supported?



I installed libavcodec-extra-52, linfaac, libfaad and etc. but the error is the same.



Do I have to install following this instruction? HOWTO: Install and use the latest FFmpeg and x264 or there is a simpler solution?










share|improve this question
























  • If you fixed your own question, put the solution in an answer of its own.
    – Wuffers
    Jul 9 '11 at 22:09










  • @Mark Szymanski Where did he give any impression that he "fixed"/solved his own question?
    – barlop
    Jul 10 '11 at 11:32










  • @barlop: if you look at the revisions, you will see that he posted and update to his question which include an answer.
    – Wuffers
    Jul 10 '11 at 13:09













up vote
0
down vote

favorite









up vote
0
down vote

favorite











My Platform: Ubuntu 10.10 + FFMPEG 0.5.3(I installed ffmpeg from source)



I try to add Watermark to a .MOV video with FFMPEG 0.5.3 imlib2.so (Please note FFMPEG 0.6+ dont support imlib2.so, so I use ffmpeg 0.5.3)



Here is my code:



ffmpeg -sameq -i example.mov -vhook '/usr/local/lib/vhook/imlib2.so -x 0 -y 0 -i /var/www/files/watermark.png' newexample.mov



Here is the output:



FFmpeg version 0.5.3, Copyright (c) 2000-2009 Fabrice Bellard, et al.
configuration: --enable-avfilter --enable-filter=movie --enable-avfilter-lavf
libavutil 49.15. 0 / 49.15. 0
libavcodec 52.20. 1 / 52.20. 1
libavformat 52.31. 0 / 52.31. 0
libavdevice 52. 1. 0 / 52. 1. 0
libavfilter 0. 4. 0 / 0. 4. 0
built on Jul 3 2011 12:05:08, gcc: 4.4.5

Seems stream 1 codec frame rate differs from container frame rate: 59.94 (5994/100) -> 29.97 (30000/1001)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'example.mov':
Duration: 00:03:14.06, start: 0.000000, bitrate: 3350 kb/s
Stream #0.0(eng): Audio: aac, 48000 Hz, stereo, s16
Stream #0.1(eng): Video: h264, yuv420p, 1150x647, 29.97 tbr, 29.97 tbn, 59.94 tbc
Output #0, mov, to 'newexample.mov':
Stream #0.0(eng): Video: mpeg4, yuv420p, 1150x647, q=2-31, 200 kb/s, 90k tbn, 29.97 tbc
Stream #0.1(eng): Audio: 0x0000, 48000 Hz, stereo, s16, 64 kb/s
Stream mapping:
Stream #0.1 -> #0.0
Stream #0.0 -> #0.1
Unsupported codec for output stream #0.1


What could be the possible problem? Is that AAC or H264 that is not supported?



I installed libavcodec-extra-52, linfaac, libfaad and etc. but the error is the same.



Do I have to install following this instruction? HOWTO: Install and use the latest FFmpeg and x264 or there is a simpler solution?










share|improve this question















My Platform: Ubuntu 10.10 + FFMPEG 0.5.3(I installed ffmpeg from source)



I try to add Watermark to a .MOV video with FFMPEG 0.5.3 imlib2.so (Please note FFMPEG 0.6+ dont support imlib2.so, so I use ffmpeg 0.5.3)



Here is my code:



ffmpeg -sameq -i example.mov -vhook '/usr/local/lib/vhook/imlib2.so -x 0 -y 0 -i /var/www/files/watermark.png' newexample.mov



Here is the output:



FFmpeg version 0.5.3, Copyright (c) 2000-2009 Fabrice Bellard, et al.
configuration: --enable-avfilter --enable-filter=movie --enable-avfilter-lavf
libavutil 49.15. 0 / 49.15. 0
libavcodec 52.20. 1 / 52.20. 1
libavformat 52.31. 0 / 52.31. 0
libavdevice 52. 1. 0 / 52. 1. 0
libavfilter 0. 4. 0 / 0. 4. 0
built on Jul 3 2011 12:05:08, gcc: 4.4.5

Seems stream 1 codec frame rate differs from container frame rate: 59.94 (5994/100) -> 29.97 (30000/1001)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'example.mov':
Duration: 00:03:14.06, start: 0.000000, bitrate: 3350 kb/s
Stream #0.0(eng): Audio: aac, 48000 Hz, stereo, s16
Stream #0.1(eng): Video: h264, yuv420p, 1150x647, 29.97 tbr, 29.97 tbn, 59.94 tbc
Output #0, mov, to 'newexample.mov':
Stream #0.0(eng): Video: mpeg4, yuv420p, 1150x647, q=2-31, 200 kb/s, 90k tbn, 29.97 tbc
Stream #0.1(eng): Audio: 0x0000, 48000 Hz, stereo, s16, 64 kb/s
Stream mapping:
Stream #0.1 -> #0.0
Stream #0.0 -> #0.1
Unsupported codec for output stream #0.1


What could be the possible problem? Is that AAC or H264 that is not supported?



I installed libavcodec-extra-52, linfaac, libfaad and etc. but the error is the same.



Do I have to install following this instruction? HOWTO: Install and use the latest FFmpeg and x264 or there is a simpler solution?







linux ubuntu ffmpeg h.264 aac






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Aug 28 '12 at 20:35









Assad Ebrahim

1,39111523




1,39111523










asked Jul 9 '11 at 20:22









DocWiki

15327




15327












  • If you fixed your own question, put the solution in an answer of its own.
    – Wuffers
    Jul 9 '11 at 22:09










  • @Mark Szymanski Where did he give any impression that he "fixed"/solved his own question?
    – barlop
    Jul 10 '11 at 11:32










  • @barlop: if you look at the revisions, you will see that he posted and update to his question which include an answer.
    – Wuffers
    Jul 10 '11 at 13:09


















  • If you fixed your own question, put the solution in an answer of its own.
    – Wuffers
    Jul 9 '11 at 22:09










  • @Mark Szymanski Where did he give any impression that he "fixed"/solved his own question?
    – barlop
    Jul 10 '11 at 11:32










  • @barlop: if you look at the revisions, you will see that he posted and update to his question which include an answer.
    – Wuffers
    Jul 10 '11 at 13:09
















If you fixed your own question, put the solution in an answer of its own.
– Wuffers
Jul 9 '11 at 22:09




If you fixed your own question, put the solution in an answer of its own.
– Wuffers
Jul 9 '11 at 22:09












@Mark Szymanski Where did he give any impression that he "fixed"/solved his own question?
– barlop
Jul 10 '11 at 11:32




@Mark Szymanski Where did he give any impression that he "fixed"/solved his own question?
– barlop
Jul 10 '11 at 11:32












@barlop: if you look at the revisions, you will see that he posted and update to his question which include an answer.
– Wuffers
Jul 10 '11 at 13:09




@barlop: if you look at the revisions, you will see that he posted and update to his question which include an answer.
– Wuffers
Jul 10 '11 at 13:09










1 Answer
1






active

oldest

votes

















up vote
1
down vote













The correct way to do this with recent ffmpeg is to use the overlay filter. The following command will place watermark.png on top of input.mp4, with the upper-left corner of the watermark fifteen pixels to the right and ten pixels down from the upper-left corner of the main video:



ffmpeg -i input.mp4 -i watermark.png -filter_complex 
'[0:v][1:v]overlay=15:10[outv]' -map [outv] -map [0:a]
-c:a copy -c:v libx264 -crf 22 -preset veryfast output.mp4


Obviously, change 15 or 10 to whatever values you want.



There are also a few constants you may find useful, if you're putting watermarks on multiple videos with separate resolutions:




  • W and H are the width and height of the main video (input.mp4)

  • w and h are the width and height of the overlay video (watermark.png)


These can come in handy many times. For example, to place the watermark over the centre of the video, you could use:



'[0:v][1:v]overlay=(W-w)/2:(H-h)/2[outv]'


Similarly, to centre the watermark over the upper-left sixth of the video:



'[0:v][1:v]overlay=(W-w)/6:(H-h)/6[outv]'


For the lower-left sixth of the video:



'[0:v][1:v]overlay=(W-w)/6:(H-h)/(6/5)[outv]'


You can pretty much do whatever you need to.



See the overlay filter documentation for more information.






share|improve this answer





















    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "3"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f308559%2fffmpeg-how-to-add-watermark-to-video%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote













    The correct way to do this with recent ffmpeg is to use the overlay filter. The following command will place watermark.png on top of input.mp4, with the upper-left corner of the watermark fifteen pixels to the right and ten pixels down from the upper-left corner of the main video:



    ffmpeg -i input.mp4 -i watermark.png -filter_complex 
    '[0:v][1:v]overlay=15:10[outv]' -map [outv] -map [0:a]
    -c:a copy -c:v libx264 -crf 22 -preset veryfast output.mp4


    Obviously, change 15 or 10 to whatever values you want.



    There are also a few constants you may find useful, if you're putting watermarks on multiple videos with separate resolutions:




    • W and H are the width and height of the main video (input.mp4)

    • w and h are the width and height of the overlay video (watermark.png)


    These can come in handy many times. For example, to place the watermark over the centre of the video, you could use:



    '[0:v][1:v]overlay=(W-w)/2:(H-h)/2[outv]'


    Similarly, to centre the watermark over the upper-left sixth of the video:



    '[0:v][1:v]overlay=(W-w)/6:(H-h)/6[outv]'


    For the lower-left sixth of the video:



    '[0:v][1:v]overlay=(W-w)/6:(H-h)/(6/5)[outv]'


    You can pretty much do whatever you need to.



    See the overlay filter documentation for more information.






    share|improve this answer

























      up vote
      1
      down vote













      The correct way to do this with recent ffmpeg is to use the overlay filter. The following command will place watermark.png on top of input.mp4, with the upper-left corner of the watermark fifteen pixels to the right and ten pixels down from the upper-left corner of the main video:



      ffmpeg -i input.mp4 -i watermark.png -filter_complex 
      '[0:v][1:v]overlay=15:10[outv]' -map [outv] -map [0:a]
      -c:a copy -c:v libx264 -crf 22 -preset veryfast output.mp4


      Obviously, change 15 or 10 to whatever values you want.



      There are also a few constants you may find useful, if you're putting watermarks on multiple videos with separate resolutions:




      • W and H are the width and height of the main video (input.mp4)

      • w and h are the width and height of the overlay video (watermark.png)


      These can come in handy many times. For example, to place the watermark over the centre of the video, you could use:



      '[0:v][1:v]overlay=(W-w)/2:(H-h)/2[outv]'


      Similarly, to centre the watermark over the upper-left sixth of the video:



      '[0:v][1:v]overlay=(W-w)/6:(H-h)/6[outv]'


      For the lower-left sixth of the video:



      '[0:v][1:v]overlay=(W-w)/6:(H-h)/(6/5)[outv]'


      You can pretty much do whatever you need to.



      See the overlay filter documentation for more information.






      share|improve this answer























        up vote
        1
        down vote










        up vote
        1
        down vote









        The correct way to do this with recent ffmpeg is to use the overlay filter. The following command will place watermark.png on top of input.mp4, with the upper-left corner of the watermark fifteen pixels to the right and ten pixels down from the upper-left corner of the main video:



        ffmpeg -i input.mp4 -i watermark.png -filter_complex 
        '[0:v][1:v]overlay=15:10[outv]' -map [outv] -map [0:a]
        -c:a copy -c:v libx264 -crf 22 -preset veryfast output.mp4


        Obviously, change 15 or 10 to whatever values you want.



        There are also a few constants you may find useful, if you're putting watermarks on multiple videos with separate resolutions:




        • W and H are the width and height of the main video (input.mp4)

        • w and h are the width and height of the overlay video (watermark.png)


        These can come in handy many times. For example, to place the watermark over the centre of the video, you could use:



        '[0:v][1:v]overlay=(W-w)/2:(H-h)/2[outv]'


        Similarly, to centre the watermark over the upper-left sixth of the video:



        '[0:v][1:v]overlay=(W-w)/6:(H-h)/6[outv]'


        For the lower-left sixth of the video:



        '[0:v][1:v]overlay=(W-w)/6:(H-h)/(6/5)[outv]'


        You can pretty much do whatever you need to.



        See the overlay filter documentation for more information.






        share|improve this answer












        The correct way to do this with recent ffmpeg is to use the overlay filter. The following command will place watermark.png on top of input.mp4, with the upper-left corner of the watermark fifteen pixels to the right and ten pixels down from the upper-left corner of the main video:



        ffmpeg -i input.mp4 -i watermark.png -filter_complex 
        '[0:v][1:v]overlay=15:10[outv]' -map [outv] -map [0:a]
        -c:a copy -c:v libx264 -crf 22 -preset veryfast output.mp4


        Obviously, change 15 or 10 to whatever values you want.



        There are also a few constants you may find useful, if you're putting watermarks on multiple videos with separate resolutions:




        • W and H are the width and height of the main video (input.mp4)

        • w and h are the width and height of the overlay video (watermark.png)


        These can come in handy many times. For example, to place the watermark over the centre of the video, you could use:



        '[0:v][1:v]overlay=(W-w)/2:(H-h)/2[outv]'


        Similarly, to centre the watermark over the upper-left sixth of the video:



        '[0:v][1:v]overlay=(W-w)/6:(H-h)/6[outv]'


        For the lower-left sixth of the video:



        '[0:v][1:v]overlay=(W-w)/6:(H-h)/(6/5)[outv]'


        You can pretty much do whatever you need to.



        See the overlay filter documentation for more information.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 24 '13 at 22:20









        evilsoup

        8,62214264




        8,62214264






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f308559%2fffmpeg-how-to-add-watermark-to-video%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Probability when a professor distributes a quiz and homework assignment to a class of n students.

            Aardman Animations

            Are they similar matrix