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

Multi tool use
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;
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
add a comment |
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
add a comment |
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
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
image video ffmpeg android-ffmpeg
edited Apr 7 at 17:22
HB.
asked Mar 25 at 6:51
HB.HB.
1,9442925
1,9442925
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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"
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
|
show 10 more comments
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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"
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
|
show 10 more comments
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"
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
|
show 10 more comments
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"
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"
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
|
show 10 more comments
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
|
show 10 more comments
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
o1NDnZtP 5 ISZWUqYT7 O,h2S e8oODiOOm8IjjUYLviJIm0,mn1XA2P6FT5 4W