View Full Version : What script do I write to crop?
php111
25th March 2008, 10:32
Hello,
How do I write a script to crop 74 pixels from top and 74 pixels from bottom? I don't know how to crop using a script. I might figure it out but I don't want to write it in.
I would be using the Lanczos Resizer.
mikeytown2
25th March 2008, 11:00
2 Recommendations:
Look at the wiki.
http://avisynth.org/mediawiki/Crop
Get AvsP
http://avisynth.org/qwerpoi/index.html
AvsP has a nice crop editor. Open up your script in AvsP, then on the menu select Video -> Crop editor...
If your looking at using the resize function to do a crop, then look in the wiki under Advanced usage:
http://avisynth.org/mediawiki/Resize
php111
25th March 2008, 11:30
I am looking at the resize option but it is NOT exactly telling me what I need to do. I even looked at it before I made this thread. I will not at all use anything else but the resize option. The same applied with an encorder. I will not at all use AutoGK. I will always use the VirtualDub products.
The movie is 720x480 PAL 16:9 progressive.
It must be something like this: LanczosResize(I don't know what 74 pixels off top and bottom will leave a resolution)
2 Recommendations:
Look at the wiki.
http://avisynth.org/mediawiki/Crop
Get AvsP
http://avisynth.org/qwerpoi/index.html
AvsP has a nice crop editor. Open up your script in AvsP, then on the menu select Video -> Crop editor...
If your looking at using the resize function to do a crop, then look in the wiki under Advanced usage:
http://avisynth.org/mediawiki/Resize
J_Darnley
25th March 2008, 14:01
mikeytown2 pointed you to the crop and the resize docs so if you can't read those then what I am about to post seems pointless. To crop you can use simply: Crop(0,74,0,-74) If you want to crop and resize in one step then you can use: LanczosResize(w,h,0,74,0,-74)
Also, are you sure that 720x480 is PAL? You either have the resolution wrong or the TV system wrong.
php111
25th March 2008, 23:23
Hey, sorry we can forget about the 74 pixels. The reason why is I have a NTSC 16:9 and I was trying to use crop values of a PAL 16:9. videohelp has told me 74 pixels coming from PAL and put it on NTSC would look very strange.
Correct me with my lines if it would be like this and maybe some additional lines if needed?
LoadPlugin("C:\Program Files\DGIndex\DGDecode.dll")
MPEG2Source("I:\The_Matrix\dvd2avi.d2v")
AddBorders(0,2,0,2)
Crop(0,76,-0,-76)
mikeytown2
26th March 2008, 00:55
Hey, sorry we can forget about the 74 pixels. The reason why is I have a NTSC 16:9 and I was trying to use crop values of a PAL 16:9. videohelp has told me 74 pixels coming from PAL and put it on NTSC would look very strange.
Correct me with my lines if it would be like this and maybe some additional lines if needed?
LoadPlugin("C:\Program Files\DGIndex\DGDecode.dll")
MPEG2Source("I:\The_Matrix\dvd2avi.d2v")
AddBorders(0,2,0,2)
Crop(0,76,-0,-76)
This should give you the same output as above without AddBorders() (http://avisynth.org/mediawiki/AddBorders)
LoadPlugin("C:\Program Files\DGIndex\DGDecode.dll")
MPEG2Source("I:\The_Matrix\dvd2avi.d2v")
#AddBorders(0,2,0,2)
Crop(0,74,-0,-74)
What are you trying to do with this video... crop off the black bars above and below (Letterboxing (http://en.wikipedia.org/wiki/Letterbox))? once that is done what is the end goal? the more info you give us, the better we can answer your questions.
php111
26th March 2008, 02:01
First of all, Yes I am trying to cut off and second. Once that is completely done, I am going to use one of my favorite products which is any of the VirtualDub and encode it to DivX Pro.
This should give you the same output as above without AddBorders() (http://avisynth.org/mediawiki/AddBorders)
LoadPlugin("C:\Program Files\DGIndex\DGDecode.dll")
MPEG2Source("I:\The_Matrix\dvd2avi.d2v")
#AddBorders(0,2,0,2)
Crop(0,74,-0,-74)
What are you trying to do with this video... crop off the black bars above and below (Letterboxing (http://en.wikipedia.org/wiki/Letterbox))? once that is done what is the end goal? the more info you give us, the better we can answer your questions.
mikeytown2
26th March 2008, 08:50
LoadPlugin("C:\Program Files\DGIndex\DGDecode.dll")
MPEG2Source("I:\The_Matrix\dvd2avi.d2v")
Crop(0,74,-0,-74)
This should accomplish your 2 goals in your previous post; except that you need to change the crop top and bottom values to match the black areas on the video. Once again i will recommend AvsP, to help you. All AvsP is, in short, is an IDE (http://en.wikipedia.org/wiki/Integrated_development_environment) for avisynth
If you want to do a crop, how i used to do it, before AvsP, load the clip in virtual dub without any crop()
LoadPlugin("C:\Program Files\DGIndex\DGDecode.dll")
MPEG2Source("I:\The_Matrix\dvd2avi.d2v")
Then in Vdub go Video -> Filters. Add null transform to the filters. Select the null transform filter and click on cropping. Advance the video to somewhere in the middle, select the Y1 (top) and Y2 (bottom) offset. Take these values, go add crop at the end of the script. Clear the null transform filter and reload your script in Vdub. Use Fast Recompress option. save avi.
If your unsure, try it out, see what happens.
php111
26th March 2008, 13:23
I have tried it over at videohelp and believe me we didn't get far.
I have told them that I can't tell if it's too dark or too light and they won't believe me. I rather use AutoCrop using Avisynth and I do not care if it doesn't work that well.
Do you want this thread to go on to like 2-3 pages like Videohelp? I sure don't. So to prevent that from happening. Using AutoCrop to make a AVS script is the way to go. If I don't go that route. It's going to be wasting everyone's time for trying to get me to crop using VirtualDub which that won't work.
2 choses. Everyone can waste time and have a long thread or we can make this short and use an LoadPlugin AutoCrop .dll
LoadPlugin("C:\Program Files\DGIndex\DGDecode.dll")
MPEG2Source("I:\The_Matrix\dvd2avi.d2v")
Crop(0,74,-0,-74)
This should accomplish your 2 goals in your previous post; except that you need to change the crop top and bottom values to match the black areas on the video. Once again i will recommend AvsP, to help you. All AvsP is, in short, is an IDE (http://en.wikipedia.org/wiki/Integrated_development_environment) for avisynth
If you want to do a crop, how i used to do it, before AvsP, load the clip in virtual dub without any crop()
LoadPlugin("C:\Program Files\DGIndex\DGDecode.dll")
MPEG2Source("I:\The_Matrix\dvd2avi.d2v")
Then in Vdub go Video -> Filters. Add null transform to the filters. Select the null transform filter and click on cropping. Advance the video to somewhere in the middle, select the Y1 (top) and Y2 (bottom) offset. Take these values, go add crop at the end of the script. Clear the null transform filter and reload your script in Vdub. Use Fast Recompress option. save avi.
If your unsure, try it out, see what happens.
Guest
26th March 2008, 14:46
Here's the link to the hilarious Video Help thread.
http://forum.videohelp.com/topic348358.html
Since you're getting such good help there, even if you seem incapable of absorbing and applying it, what is the purpose of this thread?
audyovydeo
26th March 2008, 15:12
Here's the link to the hilarious Video Help thread.
http://forum.videohelp.com/topic348358.html
This thread is also quickly becoming a pearl !!
a/v
php111
26th March 2008, 16:03
are you people lazy enough to write up a damn script? I can be lazy too.
Didée
26th March 2008, 16:18
go f*** yourself's......are you people lazy enough to write up a damn script? I can be lazy too.
Prepare to get striked for offensive wording.
Point is, WE are not lazy. It was shown to you in this thread how to crop correctly. Also it was shown to you on Videohelp.
It seems the problem lies rather with you, not with the members that tried to help you.
Guest
26th March 2008, 16:22
are you people lazy enough to write up a damn script? We've given you generic scripts, and so have the people at Video Help, but since we cannot determine the actual crop values needed, because you've not given us a sample, we cannot give you a final correct script.
php111
26th March 2008, 16:31
We've given you generic scripts, and so have the people at Video Help, but since we cannot determine the actual crop values needed, because you've not given us a sample, we cannot give you a final correct script.
That is fine. I been telling do not use VirtualDub. I rather take the estimates. I am not going to sit here and play with with the cropping in Dub. I will take the estimates. A few more questions. If someone will answer them all then I will go.
For NTSC 16:9
LoadPlugin("C:\Program Files\DGIndex\DGDecode.dll")
MPEG2Source("I:\The_Matrix\dvd2avi.d2v")
#AddBorders(0,2,0,2)
Crop(0,74,-0,-74)
Is that the right script above as for an estimate? Does that also apply for a NTSC 4:3?
What would be an estimate script for both PAL 4:3 and PAL 16:9? I have more PAL then NTSC.
Didée
26th March 2008, 16:41
In post #3:
I will not at all use AutoGK. I will always use the VirtualDub products.
In post #15:
I been telling do not use VirtualDub.
It's not easy to take you serious when you contradict yourself like that ...
php111
26th March 2008, 16:45
That is meaning. I will use VirtualDub for almost everything except cropping. Meaning I will use it for DeMux and Mux of audio. Splitting an AVI, encoding, Joining an AVI and etc... But I will not use it for cropping and I won't use AutoGK.
In post #3:
In post #15:
It's not easy to take you serious when you contradict yourself like that ...
Guest
26th March 2008, 17:00
That is fine. I been telling do not use VirtualDub. I rather take the estimates. I am not going to sit here and play with with the cropping in Dub. The problem is that you have to know the sizes of the black bars. VirtualDub provides a simple, easy-to-use GUI to determine those sizes. You've been told in detail how to do it. Yet you refuse without giving a good reason. Can you tell us why you are having a problem with the simple process that was described for you at Video Help?
So then you were asked to provide a sample so we could do that simple thing. We're still waiting for it.
That leaves us unable to know the right crop values and resize values to give you. We can give you only a generic script, which we have done.
I will take the estimates. You mean you want us to guess how big your letterboxing is? That is silly.
A few more questions. If someone will answer them all then I will go. You don't have to go.
For NTSC 16:9
LoadPlugin("C:\Program Files\DGIndex\DGDecode.dll")
MPEG2Source("I:\The_Matrix\dvd2avi.d2v")
#AddBorders(0,2,0,2)
Crop(0,74,-0,-74)
Is that the right script above as for an estimate? Does that also apply for a NTSC 4:3? Probably not, because you already said you determined those values for a PAL video and this is NTSC.
What would be an estimate script for both PAL 4:3 and PAL 16:9? I have more PAL then NTSC. If your goal is to remove black bars, it's silly for you to ask us to guess how big they are, as we are very likely to guess wrong and either leave black bars or crop good video.
Just take it as a personal challenge to get the size of the black bars or post a sample. It's not rocket science.
php111
26th March 2008, 17:09
I am willing to use GK for ONLY the crop values. I don't mean AutoGK.
Here is what he said but I turned it down, that is why we are trying to use any of the VirtualDub. If I had made this chose already, I would of had my values.
Hehe, I was editing as you were writing. For me, the easiest way to get both the crop and resize values are with the use of GKnot. You can use VDubMod to get the crop values, but unless you're familiar with the resizing math, getting a low AR Error resize can be tricky.
How do I get them using GKnot?
The problem is that you have to know the sizes of the black bars. VirtualDub provides a simple, easy-to-use GUI to determine those sizes. You've been told in detail how to do it. Yet you refuse without giving a good reason. Can you tell us why you are having a problem with the simple process that was described for you at Video Help?
So then you were asked to provide a sample so we could do that simple thing. We're still waiting for it.
That leaves us unable to know the right crop values and resize values to give you. We can give you only a generic script, which we have done.
You mean you want us to guess how big your letterboxing is? That is silly.
You don't have to go.
Probably not, because you already said you determined those values for a PAL video and this is NTSC.
If your goal is to remove black bars, it's silly for you to ask us to guess how big they are, as we are very likely to guess wrong and either leave black bars or crop good video.
Just take it as a personal challenge to get the size of the black bars or post a sample. It's not rocket science.
Guest
26th March 2008, 17:19
I asked you directly why you could not use the VirtualDub cropping GUI to determine the sizes of the black bars. Again, what is your problem in doing that?
Recall that this thread is about cropping. We can address the resizing after we have the sizes of the black bars in hand.
php111
26th March 2008, 17:22
Because I can't tell the difference if it will be too light or too dark. There is nothing I can do about that. There is nothing the doctor can do. Big deal. I did had muscle eye surgery last year around Memeorial Day but who cares. Now I did tell you why I have a problem with using it!.
I asked you directly why you could not use the VirtualDub crop GUI to determine the values. Again, what is your problem in using that?
Guest
26th March 2008, 17:27
What do you mean by "I can't tell the difference if it will be too light or too dark"?
Can you see the black bar in the cropping GUI? Can you see that as you change the numbers that the bar gets smaller?
Are you even sure that there are black bars? If you can see them in the video, you can see them in the cropping GUI.
So what is this talk about too light or too dark?
php111
26th March 2008, 17:34
What do you mean by "I can't tell the difference if it will be too light or too dark"?
Can you see the black bar in the cropping GUI? Can you see that as you change the numbers that the bar gets smaller?
Are you even sure that there are black bars? If you can see them in the video, you can see them in the cropping GUI.
So what is this talk about too light or too dark?
I am trying to use the down arrows in Y1 offset. When I press down it starts to turn more gray. If I leave it set at 0 then the whole screen is black.
Guest
26th March 2008, 17:36
After you start the cropping gui, then scroll to an area where you can see video (using the trackbar at the bottom). Don't try to do it on a fully black frame. Then keeping increasing the Y1 value. As you increase it the black bar at the top gets smaller and smaller. Stop when all of the black bar is gone. Then the Y1 value is the size of that black bar. Please try that and report back.
php111
26th March 2008, 17:38
After you start the cropping gui, then scroll to an area where you can see video. Don't try to do it on a fully black frame. Please try that and report back.
It does the same thing with video as I done it without video. It starts to turn "gray" when it is noticed cause you can see it moving in.
45tripp
26th March 2008, 17:44
whew! thank you so much........
still,
i'll take a stab in the dark:
LoadPlugin("C:\Program Files\DGIndex\DGDecode.dll")
MPEG2Source("I:\The_Matrix\dvd2avi.d2v")
crop(4,60,-4,-62)
lanczos4resize(640,272)
i thought it was game over after this.
anyway.
to get a screenshot:
open a vob in dgindex,
drag the slider along, look for bright screens, guess which screens will be best suited if your eyesight is not helping
press 'b' on the keyboard a few times,
upload 4-5 screenshots to imageshack.us
post links
you can use avi.net instead of autogk.
and with both you can get their generated scripts.
open vob in avi.net,
once it starts dispaying,
you can look for the temp directory in the directory your vob is.
open the *preview.avs
open in autogk.
hit preview button.
you can look for the temp directory in the directory your vob is.
open the *preview.avs
it doesn't get simpler
php111
26th March 2008, 17:48
i thought it was game over after this.
anyway.
to get a screenshot:
open a vob in dgindex,
drag the slider along, look for bright screens, guess which screens will be best suited if your eyesight is not helping
press 'b' on the keyboard a few times,
upload 4-5 screenshots to imageshack.us
post links
you can use avi.net instead of autogk.
and with both you can get their generated scripts.
open vob in avi.net,
once it starts dispaying,
you can look for the temp directory in the directory your vob is.
open the *preview.avs
open in autogk.
hit preview button.
you can look for the temp directory in the directory your vob is.
open the *preview.avs
it doesn't get simpler
LOCK the thread....I am done. I won't crop. I will encode as normal. Please lock the thread.
45tripp
26th March 2008, 18:09
my apologies if i've unsettled the gentle dynamic of this thread
Guest
26th March 2008, 18:23
It does the same thing with video as I done it without video. It starts to turn "gray" when it is noticed cause you can see it moving in. That's right, the black bar gets replaced with the gray background of the VirtualDub window. When the black bar becomes completely gray and the gray reaches the video, then you stop.
You have identified gray so you obviously can distinguish between black and gray. So what is the problem now?
Don't give up. You are so close!
php111
26th March 2008, 18:24
That's right, the black bar gets replaced with the gray background of the VirtualDub window. When the black bar becomes completely gray and the gray reaches the video, then you stop?
You have identified gray so you obviously can distinguish between black and gray. So what is the problem now?
Don't give up. You are so close!
Oh cool. OK let me go back to it!
php111
26th March 2008, 18:28
neutron2,
Without the gray, my screen is all of it is movie. So what I am trying to say if I crop it, it's going to put gray all over my movie.
Guest
26th March 2008, 18:35
No, it won't put gray there. It will cut away all the areas you turn to gray.
So, you can say OK and then see how VirtualDub shows your video in the output pane (not the input pane).
Now tell us the numbers you got when you have just movie left and no black around it. Then with those numbers we can give you a final script for Avisynth if you prefer to crop there.
php111
26th March 2008, 18:41
Can you tell I am very new to cropping? Can you also tell I like and rather working with basic and learning scripts then cropping?
Back to point A: I have no values. Once again everything is set "0" because my whole screen is "video".
No, it won't put gray there. It will cut away all the areas you turn to gray.
So, you can say OK and then see how VirtualDub shows your video in the output pane (not the input pane).
Now tell us the numbers you got when you have just movie left and no black around it. Then with those numbers we can give you a final script for Avisynth if you prefer to crop there.
Guest
26th March 2008, 18:45
Can you tell I am very new to cropping? Can you also tell I like and rather working with basic and learning scripts then cropping?
Back to point A: I have no values. Once again everything is set "0" because my whole screen is "video". Oh. That's what I was suspecting earlier. But you said earlier you were trying to cut off black bars. Now you say there are none.
Is there an explanation for that?
If you are not trying to cut off black bars, then what ARE you trying to do?
php111
26th March 2008, 18:49
Oh. That's what I was suspecting earlier. But you said earlier you were trying to cut off black bars. Now you say there are none.
Is there an explanation for that?
If you are not trying to cut off black bars, then what ARE you trying to do?
You can give me a whole list of movies with all black bars. I am going to take a wild guess and say there are none. Do I know if it has black bars? I am going to guess and say no.
Guest
26th March 2008, 18:55
It sounds to me like your source video is 16:9 but not letterboxed, which means you didn't rip it from a DVD.
Where did you get it?
g-force
26th March 2008, 20:35
It sounds to me like your source video is 16:9 but not letterboxed, which means you didn't rip it from a DVD.
Where did you get it?
I was dreading that question because I enjoy reading this thread too much!
-G
manono
27th March 2008, 03:12
But earlier over at Videohelp.com we established this was the NTSC DVD of The Matrix, and that he already had a D2V made for it. The Matrix is 2.35 (or 2.40):1, and should have a significant amount of black bars. What I've been afraid of asking myself was how the DVD was decrypted, as that DVD has some serious angles.
Guest
27th March 2008, 04:05
Did anybody get the frame size of his source? I know he never gave the GSpot result.
manono
27th March 2008, 06:48
The all-black BMP he uploaded at Videohelp.com (now removed) was 720x480, if memory serves. And the VOB he tried to upload instead of a JPG pic has to be 720x480:
http://forum.videohelp.com/topic348358-30.html#1829715
The only way it wouldn't have any black bars would be if someone had cropped the image from the sides, removed the black bars, resized it for 720x480, and then reencoded it as a 16:9 DVD. Plus he made a D2V, so he's definitely working with an NTSC DVD of some sort. Personally, while I suspect some funny business of some sort, I don't think it's with the source. But I admit the difficulty of getting a screenshot makes me somewhat suspicious. I'm also surprised at my own patience with php111. Maybe it's because I'm curious (like g-force above) as to how it's going to play out.
45tripp
27th March 2008, 09:03
The only way it wouldn't have any black bars would be if someone had cropped the image from the sides, removed the black bars, resized it for 720x480, and then reencoded it as a 16:9 DVD.
I can imagine butchery worse than that.
i found it hard to believe someone would try to crop
non-existing borders.
The all-black BMP he uploaded at Videohelp.com (now removed) was 720x480, if memory serves.
it was.
i don't think it was all black though.
i recall a hint of green, top right corner,
like the matrix code was about to roll.
too high up for 2.35 borders.
i found it hard to believe someone would try to crop
for the sake of cropping.
i guess it's funny.
also,
i don't understand the refuse to use automation tools,
considering user level.
and resizing wasn't touched,
which i'd pin as a stumbling block,
if bet's were on.
audyovydeo
27th March 2008, 09:54
This thread is sublime. Everyone's looking for logic where there's none to be found. Just enjoy it. Like poetry.
cheers
audyovydeo
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.