Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > VapourSynth

Reply
 
Thread Tools Search this Thread Display Modes
Old 25th September 2020, 23:34   #1  |  Link
groucho86
Registered User
 
Join Date: Apr 2016
Posts: 85
Resize + Pad to keep image centered

I have a 1998x998 source that I need to "fit all" within a 1920x1080 container.

That means resizing 1998x998 to ~1920x959.04 and padding top and bottom to fill the height to 1080.

I'm currently scaling first to 1920x960 then padding top and bottom but then I'm not getting a perfect 1:1 compared to other softwares.

Ideally I'd like to preserve subpixel accuracy but I'm struggling with using src_top, src_height, etc.

Anyone know of a convenience function to resize & pad while keeping the image perfectly centered?

Last edited by groucho86; 25th September 2020 at 23:54. Reason: Typo
groucho86 is offline   Reply With Quote
Old 26th September 2020, 07:43   #2  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,259
Quote:
Anyone know of a convenience function to resize & pad while keeping the image perfectly centered?
No.
Quote:
but then I'm not getting a perfect 1:1 compared to other softwares.
Does it look better to you if you first pad and then resize?
1998x998->1998x1124 (pad) -> 1920x1080 (resize)
that's the only different way that jumps to mind,..
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 26th September 2020, 14:15   #3  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 3,997
You could try the ffmpeg filter
Code:
-filter:v "scale=1920:-2, pad=1920:1080:(ow-iw)/2:(oh-ih)/2, setdar=16/9"
It keeps the AR within mod 2 and centers the picture.

Last edited by Sharc; 26th September 2020 at 14:19.
Sharc is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 23:57.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.