Add image with scale + rotation to video overlay with FFMPEG?
I want to add overlay images to videos with params
1: w:h --> is width and height of image on the video
2: r --> Radian is rotation of images
3: center (x,y) --> is center point of image in the video
This is my FFMPEG command :
-i video.mp4 -i image.png filter_complex [1:v]scale=w:h[scale];[scale]rotate=r:ow=iw:oh=ih[rotate];[0:v][rotate]overlay=x-(w/2):y-(h/2)
But the result not correct. It's Only work with scale=1 and rotate=0 radian
How can i do this ?
image video ffmpeg rotation overlay
add a comment |
I want to add overlay images to videos with params
1: w:h --> is width and height of image on the video
2: r --> Radian is rotation of images
3: center (x,y) --> is center point of image in the video
This is my FFMPEG command :
-i video.mp4 -i image.png filter_complex [1:v]scale=w:h[scale];[scale]rotate=r:ow=iw:oh=ih[rotate];[0:v][rotate]overlay=x-(w/2):y-(h/2)
But the result not correct. It's Only work with scale=1 and rotate=0 radian
How can i do this ?
image video ffmpeg rotation overlay
add a comment |
I want to add overlay images to videos with params
1: w:h --> is width and height of image on the video
2: r --> Radian is rotation of images
3: center (x,y) --> is center point of image in the video
This is my FFMPEG command :
-i video.mp4 -i image.png filter_complex [1:v]scale=w:h[scale];[scale]rotate=r:ow=iw:oh=ih[rotate];[0:v][rotate]overlay=x-(w/2):y-(h/2)
But the result not correct. It's Only work with scale=1 and rotate=0 radian
How can i do this ?
image video ffmpeg rotation overlay
I want to add overlay images to videos with params
1: w:h --> is width and height of image on the video
2: r --> Radian is rotation of images
3: center (x,y) --> is center point of image in the video
This is my FFMPEG command :
-i video.mp4 -i image.png filter_complex [1:v]scale=w:h[scale];[scale]rotate=r:ow=iw:oh=ih[rotate];[0:v][rotate]overlay=x-(w/2):y-(h/2)
But the result not correct. It's Only work with scale=1 and rotate=0 radian
How can i do this ?
image video ffmpeg rotation overlay
image video ffmpeg rotation overlay
asked Nov 16 '18 at 10:24
Young KingYoung King
308
308
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Use
[1:v]scale=w:h,pad=iw+4:ih+4:black@0[scale];[scale]rotate=r:ow='rotw(r)':oh='roth(r)'[rotate]
A bit of transparent padding is added to the image before rotation. This is because the rotate filter will fill the gaps in the canvas with the input's border pixel color. Also, the output size has to be adjusted to accommodate the whole image after rotation. See the docs for the rotate filter.
Thankyou so @Gyan
– Young King
Nov 20 '18 at 4:02
add a comment |
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%2f53335880%2fadd-image-with-scale-rotation-to-video-overlay-with-ffmpeg%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
Use
[1:v]scale=w:h,pad=iw+4:ih+4:black@0[scale];[scale]rotate=r:ow='rotw(r)':oh='roth(r)'[rotate]
A bit of transparent padding is added to the image before rotation. This is because the rotate filter will fill the gaps in the canvas with the input's border pixel color. Also, the output size has to be adjusted to accommodate the whole image after rotation. See the docs for the rotate filter.
Thankyou so @Gyan
– Young King
Nov 20 '18 at 4:02
add a comment |
Use
[1:v]scale=w:h,pad=iw+4:ih+4:black@0[scale];[scale]rotate=r:ow='rotw(r)':oh='roth(r)'[rotate]
A bit of transparent padding is added to the image before rotation. This is because the rotate filter will fill the gaps in the canvas with the input's border pixel color. Also, the output size has to be adjusted to accommodate the whole image after rotation. See the docs for the rotate filter.
Thankyou so @Gyan
– Young King
Nov 20 '18 at 4:02
add a comment |
Use
[1:v]scale=w:h,pad=iw+4:ih+4:black@0[scale];[scale]rotate=r:ow='rotw(r)':oh='roth(r)'[rotate]
A bit of transparent padding is added to the image before rotation. This is because the rotate filter will fill the gaps in the canvas with the input's border pixel color. Also, the output size has to be adjusted to accommodate the whole image after rotation. See the docs for the rotate filter.
Use
[1:v]scale=w:h,pad=iw+4:ih+4:black@0[scale];[scale]rotate=r:ow='rotw(r)':oh='roth(r)'[rotate]
A bit of transparent padding is added to the image before rotation. This is because the rotate filter will fill the gaps in the canvas with the input's border pixel color. Also, the output size has to be adjusted to accommodate the whole image after rotation. See the docs for the rotate filter.
answered Nov 16 '18 at 13:25
GyanGyan
34.1k22971
34.1k22971
Thankyou so @Gyan
– Young King
Nov 20 '18 at 4:02
add a comment |
Thankyou so @Gyan
– Young King
Nov 20 '18 at 4:02
Thankyou so @Gyan
– Young King
Nov 20 '18 at 4:02
Thankyou so @Gyan
– Young King
Nov 20 '18 at 4:02
add a comment |
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%2f53335880%2fadd-image-with-scale-rotation-to-video-overlay-with-ffmpeg%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