View Full Version : How do I crop and maintain the correct AR and resize to a standardized resolution?
Comatose
12th April 2008, 06:21
So, I have this TS (1440*1080) that I want to encode to x264 and put in a MKV with a 16:9 flag to make it anamorphic.
The problem is that I want to crop the overscan out while maintaining a standard resolution such as 1080i.
If I crop and then resize, the aspect ratio will obviously be off.
How can I work around this, without using one of the cropping methods that cause you to lose part of the frame?
thetoof
12th April 2008, 08:14
This is what I usually do:
1. Crop the overscan
2. Resize to the closest mod16 AR (i.e. if you cropped to 700x430, resize to 704x432)
3. Encode
4. In MKVmerge, use an anamorphic flag to specify the Display Aspect Ratio you need.
Hope it helped!
DarkT
12th April 2008, 09:17
Comatose asks wether or not there's AR mess with the HD resolution, like there is with the DVDs (http://forum.doom9.org/showthread.php?t=134911).
I'm curious as well, is the hd resolution 1:1 with pc resolution? How does it go?
thetoof
12th April 2008, 09:33
I think it's 1:1 since afaik HDTVs also have a square pixel resolution.
However, when you specify another DAR than the encoded resolution with an anamorphic flag in mkvmerge, it doesn't really matter. If I'm not mistaken, you can achieve higher quality when you stay as close as possible to the source AR when resizing to mod 16 (like my previous example) and then "anamorphise" your encode to the "original" AR. The trick I have to be sure of the "original" aspect ratio is to check it in imdb under the Additional Details detail section.
thetoof
12th April 2008, 10:22
a=problematicclip.trim(0,last frame before buggy)
b=good clip.trim(frame that is the exact same as the first buggy, last buggy)
c=problematicclip.trim(frame right after last buggy, end of movie)
a+b+c
edit: Heum... well... seems like your post disappeared while I was writing :p (Comatose was asking how to replace currupted frames of a clip with the equivalent of another source)
Comatose
12th April 2008, 11:05
Yes :p I deleted it, since DarkT answered my question on MSN. It was so obvious that I wasn't thinking in its direction =/
Thanks anyway :P
I wrote a function to do this:
function insertframes(clip to, clip from, int start) {
last=to
from=((from.width!=width)&&(from.height!=height))?from.lanczos4resize(width,height):from
from=from.assumefps(framerate)
end=from.framecount+start
trim(0,start-1)+from+trim(end+1,0)
}
Gavino
12th April 2008, 18:44
from=((from.width!=width)&&(from.height!=height))?from.lanczos4resize(width,height):from
Should be using logical or instead of and here, ie
from=((from.width!=width)||(from.height!=height))?from.lanczos4resize(width,height):from
Also,
trim(0,start-1)+from+trim(end+1,0)
won't work if start is 0 or 1. Use trim(0, -start) to fix the start=1 case. If you need to cover start=0 too, you will have to treat is as a special case.
Wouldn't be a bad idea to do some validity checks too, eg what if inserted clip is too long?
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.