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 > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 28th May 2015, 00:45   #1  |  Link
8-BaLL
Registered User
 
Join Date: Jun 2012
Posts: 75
Multiple cropping in 1 video?

Hello,

is there a way to use multiple+different cropping in 1 video?

Lets say I have a video with 2 different black bars, like 1 part has 4+10 pixel black bars and the 2nd part has 8+6 pixel black bars.

Is there a way to crop both parts accordingly?
8-BaLL is offline   Reply With Quote
Old 28th May 2015, 01:42   #2  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Not completely sure what you wanted (4+10, 8+6) but maybe this will do.
Code:
SomeSource("Whatever.xxx")

A=Trim(0,Part1_EndFrm)          # 1st make two separate clips    
B=Trim(Part1_EndFrm+1,0)

A=A.Crop(0,4,0,-10)             # Have guessed by 4+10 you mean 4 off top and 10 off bottom.
B=B.Crop(0,8,0,-6)              # Have guessed by 8+6 you mean 8 off top and 6 off bottom.

Return A++B                     # glue them back 2gether again.
If interlaced can only crop vertical in multiples of 4 (YV12), also both cropped clips must result in same size
otherwise must make same size (crop more/less [or resize only if not interlaced]).

EDIT: Having seen your other post in another thread, have changed to below (4+10, 8+6 being left and right).
Code:
SomeSource("Whatever.xxx")

A=Trim(0,Part1_EndFrm)          # 1st make two separate clips    
B=Trim(Part1_EndFrm+1,0)

A=A.Crop(4,0,-10,0)
B=B.Crop(8,0,-6,0)

Return A++B                     # glue them back 2gether again.
However, 720 - 14 is 706 and not a valid horizontal DVD resolution
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 28th May 2015 at 02:08. Reason: correction to guess
StainlessS is offline   Reply With Quote
Old 28th May 2015, 02:10   #3  |  Link
8-BaLL
Registered User
 
Join Date: Jun 2012
Posts: 75
OK thank you , looks like what I need, 4+10, 8+6 is left bar and right bar.

Also why is B=Trim(Part1_EndFrm+1,0)

and not B=Trim(Part1_EndFrm+Part2_EndFrm) ? What does 1,0 mean?

Yes video is same pixel size ofcourse its 1 dvd video.

Last edited by 8-BaLL; 28th May 2015 at 02:13.
8-BaLL is offline   Reply With Quote
Old 28th May 2015, 02:22   #4  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
B=Trim(Part1_EndFrm+1,0)

The start position for the 2nd part is 1 higher than the end frame for the 1st part.
And, End Frame of 0, means 'to the very last frame'.
Also, a -ve End Frame means '-ve this many frames' ie -1 means 1 frames and -20096 means 20096 frames.

But, as in edit above, 706 width is not valid for NTSC DVD (EDIT: 720 or 704 only, I think [not counting half width versions]).
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 28th May 2015 at 02:32.
StainlessS is offline   Reply With Quote
Old 28th May 2015, 02:36   #5  |  Link
8-BaLL
Registered User
 
Join Date: Jun 2012
Posts: 75
Thanks for the info, well you can check the image out yourself:

after cropping it is 708 pixels:

8-BaLL is offline   Reply With Quote
Old 28th May 2015, 02:46   #6  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
720 - (4+10) and 720 - (8+6) are both 706.
I would just chop off another 2 pixels from one side or other (for both parts) and have it at 704x480 which
is I believe still valid, perhaps someone could verify that 704 is valid NTSC dvd width.

EDIT: Would have to be 2 additional pixels from one or other side, and not 1 pixel from left and 1 from right, ie can only
crop horizontal multiples of 2 pixels in YV12.

EDIT: For that particular frame, I would just chop off 8 pixels either side = 704 wide.

EDIT: Ignore above, seen in other thread that your destination is x264 and not DVD.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 28th May 2015 at 03:24.
StainlessS is offline   Reply With Quote
Old 28th May 2015, 13:13   #7  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,829
I do it like this, but the end result is the same.

Trim(0,500).crop(4,0,-10,0)/
++Trim(501,1000).crop(8,0,-6,0)/
++Trim(1001,0).crop(4,0,-10,0)

(when you use zero as the second number for Trim it means "keep going to the end")

If you're resizing, you're free to crop completely differently if you like.

Trim(0,500).crop(6,2,-10,-4).Spline36Resize(640,480)/
++Trim(501,1000).crop(18,8,-6,-6).Spline36Resize(640,480)/
++Trim(1001,0).crop(12,4,-6,-4).Spline36Resize(640,480)

Each section needs to be the same dimensions whether you do it by cropping or resizing or both.
Obviously you'd still crop to achieve the correct display aspect ratio when resizing each section (the above wouldn't necessarily be 1.3333 as I just made up numbers) but if you're resizing it lets you crop different sections completely differently if need be.
And of course you're not just limited to different cropping or resizing. You can apply any filtering to sections of video using the above method.

Last edited by hello_hello; 28th May 2015 at 13:24.
hello_hello is offline   Reply With Quote
Old 28th May 2015, 13:59   #8  |  Link
8-BaLL
Registered User
 
Join Date: Jun 2012
Posts: 75
@hello_hello-

thank you! It was exatly what I was looking for. This helped me realize how to separately edit scenes.
8-BaLL is offline   Reply With Quote
Old 30th May 2015, 10:58   #9  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,829
That's kind of why I was saying in the other thread I tend not to over-think the cropping too much, especially as I resize to square pixel dimensions anyway, so as long as each section is cropped cleanly to 4:3, even if it means cropping a little picture, the end result is a nice, clean 4:3 output.

When resizing to square pixels in a perfect world you wouldn't resize the height. You'd crop the black and resize the width to give you the correct aspect ratio, but I find I'm often cropping a little more here and resizing a little more there..... and even if I was using anamorphic encoding sometimes I still resize a bit here and there..... for me even a single encode is often a collection of little compromises.

Oh..... and eventually you might discover you can effectively crop an odd number of pixels (not just multiples of two) if you're resizing, and when you do if you're anything like me your cropping/resizing/aspect ratio OCD tendencies will ramp up another gear, occasionally requiring medication.

Because the resize filters can crop an odd numbers of pixels, if you wanted to crop 9 pixels from the left, 2 from the top, 4 from the right and 7 from the bottom, you could do this:

Crop(8, 2, -4, -6)
Spline36Resize(640,480,1,0,0,-1)

Last edited by hello_hello; 30th May 2015 at 11:12.
hello_hello 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 06:33.


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