FFMPEG : overlay image on video and retain sizeFFmpeg adding image watermark to video process is very slowLazy load of images in ListViewHow do I auto-resize an image to fit a 'div' container?Rotating videos with FFmpegHow to vertically align an image inside a div?Changing image size in MarkdownCutting the videos based on start and end time using ffmpegffmpeg - compositing a video within a video in the centreffmpeg scale2ref explanation?ffmpeg scale logo size according to video sizeMultiple overlays using ffmpeg

What are the pros and cons for the two possible "gear directions" when parking the car on a hill?

Why isn't it a compile-time error to return a nullptr as a std::string?

Extending prime numbers digit by digit while retaining primality

Has a life raft ever been successfully deployed on a modern commercial flight?

Cut the gold chain

Boss wants someone else to lead a project based on the idea I presented to him

Explicit song lyrics checker

How did the Vostok ejection seat safely eject an astronaut from a sealed space capsule?

How much steel armor can you wear and still be able to swim?

What is the meaning of "понаехать"?

Dmesg full of I/O errors, smart ok, four disks affected

What is the highest voltage from the power supply a Raspberry Pi 3 B can handle without getting damaged?

Why does independence imply zero correlation?

Improve appearance of the table in Latex

King or Queen-Which piece is which?

I found a password with hashcat, but it doesn't work

How could empty set be unique if it could be vacuously false

Is there a difference between an NFC and RFID chip?

Syntax and semantics of XDV commands (XeTeX)

Are there any individual aliens that have gained superpowers in the Marvel universe?

How hard is it to distinguish if I am given remote access to a virtual machine vs a piece of hardware?

How can I prevent a user from copying files on another hard drive?

How long did the SR-71 take to get to cruising altitude?

Why does std::string_view create a dangling view in a ternary expression?



FFMPEG : overlay image on video and retain size


FFmpeg adding image watermark to video process is very slowLazy load of images in ListViewHow do I auto-resize an image to fit a 'div' container?Rotating videos with FFmpegHow to vertically align an image inside a div?Changing image size in MarkdownCutting the videos based on start and end time using ffmpegffmpeg - compositing a video within a video in the centreffmpeg scale2ref explanation?ffmpeg scale logo size according to video sizeMultiple overlays using ffmpeg






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I'm trying to overlay an image (transparent background with shape in the middle) "on top" of the video and get the image back. The image size is bigger then the video. Here is the command that I'm using:



"-i", video.mp4, "-i", image.mp4, "-filter_complex", "[1:v][0:v]scale2ref=iw:ih[ovr][base];[ovr]colorchannelmixer=aa=1.0[ovrl];[base][ovrl]overlay[v]", "-map", "[v]", "-q:v", "2", directoryToStore + "/" + ImageName + ".jpeg"


The above scales the image to the size of the video.



I want the image and the video to retain their size and output an image of the 2 overlaid.



Can someone please give me advice on how I can do this?










share|improve this question






























    0















    I'm trying to overlay an image (transparent background with shape in the middle) "on top" of the video and get the image back. The image size is bigger then the video. Here is the command that I'm using:



    "-i", video.mp4, "-i", image.mp4, "-filter_complex", "[1:v][0:v]scale2ref=iw:ih[ovr][base];[ovr]colorchannelmixer=aa=1.0[ovrl];[base][ovrl]overlay[v]", "-map", "[v]", "-q:v", "2", directoryToStore + "/" + ImageName + ".jpeg"


    The above scales the image to the size of the video.



    I want the image and the video to retain their size and output an image of the 2 overlaid.



    Can someone please give me advice on how I can do this?










    share|improve this question


























      0












      0








      0








      I'm trying to overlay an image (transparent background with shape in the middle) "on top" of the video and get the image back. The image size is bigger then the video. Here is the command that I'm using:



      "-i", video.mp4, "-i", image.mp4, "-filter_complex", "[1:v][0:v]scale2ref=iw:ih[ovr][base];[ovr]colorchannelmixer=aa=1.0[ovrl];[base][ovrl]overlay[v]", "-map", "[v]", "-q:v", "2", directoryToStore + "/" + ImageName + ".jpeg"


      The above scales the image to the size of the video.



      I want the image and the video to retain their size and output an image of the 2 overlaid.



      Can someone please give me advice on how I can do this?










      share|improve this question
















      I'm trying to overlay an image (transparent background with shape in the middle) "on top" of the video and get the image back. The image size is bigger then the video. Here is the command that I'm using:



      "-i", video.mp4, "-i", image.mp4, "-filter_complex", "[1:v][0:v]scale2ref=iw:ih[ovr][base];[ovr]colorchannelmixer=aa=1.0[ovrl];[base][ovrl]overlay[v]", "-map", "[v]", "-q:v", "2", directoryToStore + "/" + ImageName + ".jpeg"


      The above scales the image to the size of the video.



      I want the image and the video to retain their size and output an image of the 2 overlaid.



      Can someone please give me advice on how I can do this?







      image video ffmpeg android-ffmpeg






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Apr 7 at 17:22







      HB.

















      asked Mar 25 at 6:51









      HB.HB.

      1,9442925




      1,9442925






















          1 Answer
          1






          active

          oldest

          votes


















          2














          Skip the scale2ref.



          "-i", video.mp4, "-i", image.mp4, "-filter_complex", "[0:v]pad=iw:2*trunc(iw*16/9/2):(ow-iw)/2:(oh-ih)/2[v0];[1:v][v0]scale2ref[v1][v0];[v0][v1]overlay=x=(W-w)/2:y=(H-h)/2[v]", "-map", "[v]", "-q:v", "2", directoryToStore + "/" + ImageName + ".jpeg"






          share|improve this answer

























          • Thank you for your answers, the image still get scale and moved to incorrect position, should I provide a image to demonstrate?

            – HB.
            Mar 25 at 7:44











          • Please see my edit

            – HB.
            Mar 25 at 7:53











          • How are you viewing the result?

            – Gyan
            Mar 25 at 7:56











          • on a android phone

            – HB.
            Mar 25 at 8:12











          • Then you have to pad the video and scale the image. Will edit command.

            – Gyan
            Mar 25 at 8:16











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          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',
          autoActivateHeartbeat: false,
          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%2fstackoverflow.com%2fquestions%2f55332539%2fffmpeg-overlay-image-on-video-and-retain-size%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









          2














          Skip the scale2ref.



          "-i", video.mp4, "-i", image.mp4, "-filter_complex", "[0:v]pad=iw:2*trunc(iw*16/9/2):(ow-iw)/2:(oh-ih)/2[v0];[1:v][v0]scale2ref[v1][v0];[v0][v1]overlay=x=(W-w)/2:y=(H-h)/2[v]", "-map", "[v]", "-q:v", "2", directoryToStore + "/" + ImageName + ".jpeg"






          share|improve this answer

























          • Thank you for your answers, the image still get scale and moved to incorrect position, should I provide a image to demonstrate?

            – HB.
            Mar 25 at 7:44











          • Please see my edit

            – HB.
            Mar 25 at 7:53











          • How are you viewing the result?

            – Gyan
            Mar 25 at 7:56











          • on a android phone

            – HB.
            Mar 25 at 8:12











          • Then you have to pad the video and scale the image. Will edit command.

            – Gyan
            Mar 25 at 8:16















          2














          Skip the scale2ref.



          "-i", video.mp4, "-i", image.mp4, "-filter_complex", "[0:v]pad=iw:2*trunc(iw*16/9/2):(ow-iw)/2:(oh-ih)/2[v0];[1:v][v0]scale2ref[v1][v0];[v0][v1]overlay=x=(W-w)/2:y=(H-h)/2[v]", "-map", "[v]", "-q:v", "2", directoryToStore + "/" + ImageName + ".jpeg"






          share|improve this answer

























          • Thank you for your answers, the image still get scale and moved to incorrect position, should I provide a image to demonstrate?

            – HB.
            Mar 25 at 7:44











          • Please see my edit

            – HB.
            Mar 25 at 7:53











          • How are you viewing the result?

            – Gyan
            Mar 25 at 7:56











          • on a android phone

            – HB.
            Mar 25 at 8:12











          • Then you have to pad the video and scale the image. Will edit command.

            – Gyan
            Mar 25 at 8:16













          2












          2








          2







          Skip the scale2ref.



          "-i", video.mp4, "-i", image.mp4, "-filter_complex", "[0:v]pad=iw:2*trunc(iw*16/9/2):(ow-iw)/2:(oh-ih)/2[v0];[1:v][v0]scale2ref[v1][v0];[v0][v1]overlay=x=(W-w)/2:y=(H-h)/2[v]", "-map", "[v]", "-q:v", "2", directoryToStore + "/" + ImageName + ".jpeg"






          share|improve this answer















          Skip the scale2ref.



          "-i", video.mp4, "-i", image.mp4, "-filter_complex", "[0:v]pad=iw:2*trunc(iw*16/9/2):(ow-iw)/2:(oh-ih)/2[v0];[1:v][v0]scale2ref[v1][v0];[v0][v1]overlay=x=(W-w)/2:y=(H-h)/2[v]", "-map", "[v]", "-q:v", "2", directoryToStore + "/" + ImageName + ".jpeg"







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 25 at 8:19

























          answered Mar 25 at 7:39









          GyanGyan

          36.8k23374




          36.8k23374












          • Thank you for your answers, the image still get scale and moved to incorrect position, should I provide a image to demonstrate?

            – HB.
            Mar 25 at 7:44











          • Please see my edit

            – HB.
            Mar 25 at 7:53











          • How are you viewing the result?

            – Gyan
            Mar 25 at 7:56











          • on a android phone

            – HB.
            Mar 25 at 8:12











          • Then you have to pad the video and scale the image. Will edit command.

            – Gyan
            Mar 25 at 8:16

















          • Thank you for your answers, the image still get scale and moved to incorrect position, should I provide a image to demonstrate?

            – HB.
            Mar 25 at 7:44











          • Please see my edit

            – HB.
            Mar 25 at 7:53











          • How are you viewing the result?

            – Gyan
            Mar 25 at 7:56











          • on a android phone

            – HB.
            Mar 25 at 8:12











          • Then you have to pad the video and scale the image. Will edit command.

            – Gyan
            Mar 25 at 8:16
















          Thank you for your answers, the image still get scale and moved to incorrect position, should I provide a image to demonstrate?

          – HB.
          Mar 25 at 7:44





          Thank you for your answers, the image still get scale and moved to incorrect position, should I provide a image to demonstrate?

          – HB.
          Mar 25 at 7:44













          Please see my edit

          – HB.
          Mar 25 at 7:53





          Please see my edit

          – HB.
          Mar 25 at 7:53













          How are you viewing the result?

          – Gyan
          Mar 25 at 7:56





          How are you viewing the result?

          – Gyan
          Mar 25 at 7:56













          on a android phone

          – HB.
          Mar 25 at 8:12





          on a android phone

          – HB.
          Mar 25 at 8:12













          Then you have to pad the video and scale the image. Will edit command.

          – Gyan
          Mar 25 at 8:16





          Then you have to pad the video and scale the image. Will edit command.

          – Gyan
          Mar 25 at 8:16



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55332539%2fffmpeg-overlay-image-on-video-and-retain-size%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

          Obelisk of Theodosius Contents History Description Notes Bibliography Further reading External links Navigation menuAge of spirituality : late antique and early Christian art, third to seventh centuryOver 60 picturesObelisks of the World41°00′21.24″N 28°58′31.43″E / 41.0059000°N 28.9753972°E / 41.0059000; 28.97539727724550-7235741376235741376

          밀양 대씨 역사 각주 함께 보기 둘러보기 메뉴밀양 대씨

          1973년 목차 사건 문화 탄생 사망 노벨상 달력 둘러보기 메뉴