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 3rd November 2002, 05:15   #1  |  Link
CropsyX
Registered User
 
Join Date: Oct 2002
Posts: 31
New filter: AutoCrop

AutoCrop is a simple AVISynth Filter that automatically crops the black borders from a
clip. It operates in either preview mode where it overlays the recommended cropping
information on the existing clip, or cropping mode where it really crops the clip. It can
also ensure width and height are multiples of specified numbers so the cropped clip can be
passed to the video compressor of your choice without problems.

This is the first release of this filter and also my first AviSynth filter, so there may
be some problems. Feedback about problems and suggestions for improvements are welcome.

It has occurred to me that this filter maybe to simplistic for AviSynth users who are
generally a pretty savvy lot but I've decided to release it anyway. Someone might find it
useful and I'd like to contribute something back to the AviSynth community whose tools I
use regularly.

http://www.videofringe.com/autocrop/autocrop.zip
CropsyX is offline   Reply With Quote
Old 3rd November 2002, 10:46   #2  |  Link
FLeXO
Registered User
 
FLeXO's Avatar
 
Join Date: Nov 2001
Posts: 4
Wow,, this filter seems to work just fine here.. it saves alot of time.. thanx.
FLeXO is offline   Reply With Quote
Old 3rd November 2002, 11:47   #3  |  Link
JohnMK
Registered User
 
Join Date: Sep 2002
Location: Seattle
Posts: 551
How does aspect ratio factor into this? Typically I crop to preserve aspect ratio too.
JohnMK is offline   Reply With Quote
Old 3rd November 2002, 11:57   #4  |  Link
Rrrough
Registered User
 
Rrrough's Avatar
 
Join Date: Aug 2002
Location: Avantasia
Posts: 177
...and for future YV12-versions you should make it MOD 4-aware
keep up the good work.

cheers
Rrrough is offline   Reply With Quote
Old 3rd November 2002, 13:38   #5  |  Link
CropsyX
Registered User
 
Join Date: Oct 2002
Posts: 31
Quote:
Originally posted by JohnMK
How does aspect ratio factor into this? Typically I crop to preserve aspect ratio too.
At the moment it doesn't. I'm still trying to decide wether it would be better to throw away extra used lines to maintain the aspect ratio or include some blank lines. I don't usually crop to maintain aspect ratio so I'm open to suggestions.

Rrrough

I'll definitely need to do some research into YV12 in the not too distant future. At the moment I know as much about YV12 as did YUY2 a week ago ie. Nothing

I'd like to lock down the feature set of AutoCrop first though if possible.
CropsyX is offline   Reply With Quote
Old 3rd November 2002, 14:02   #6  |  Link
Rrrough
Registered User
 
Rrrough's Avatar
 
Join Date: Aug 2002
Location: Avantasia
Posts: 177
no need to rush. I think it's a good idea of making it MOD 4-aware anyway and it might assure you compatibility with future versions.
it's definetly a great filter-idea !

cheers
Rrrough is offline   Reply With Quote
Old 5th November 2002, 06:21   #7  |  Link
CropsyX
Registered User
 
Join Date: Oct 2002
Posts: 31
AutoCrop updates

I've released version 0.3 which fixes the following problems.

Setting wMultOf=width now behaves correctly. ie. Just letterboxes the clip.

Debugging information no longer written to disk.

Thanks to Nesti for pointing out these problems.

It's available from

http://www.videofringe.com/autocrop/autocrop.zip
CropsyX is offline   Reply With Quote
Old 11th November 2002, 18:11   #8  |  Link
ldivx
Registered User
 
Join Date: Aug 2002
Posts: 14
Great work.
But when i use your autocrop
how can i resize in keep "aspect ratio" without know the autocrop value ???.

Can you put variable for know the crop value for make a good resize.


Sorry for the mistakes. i'm just a french.

In french :
Beau travail, mais comment peut t'on savoir quels sont les valeurs de l'auto-crop pour pouvoir redimmensionner le fichier vidéo en gardant l'aspect ratio. serait il possible d'implementer des variables pour faire un bon crop.

Exemples :

AutoCrop(preview=true,hMultOf=4,wMultOf=width)
# Resize
LanczosResize(AutoCropvalue)

If you have have beta version i can test it.
byebye.
__________________
My rippack only in french for this moment but i can traduce if you would
http://www.ldivx.fr.st
ldivx is offline   Reply With Quote
Old 13th November 2002, 07:48   #9  |  Link
CropsyX
Registered User
 
Join Date: Oct 2002
Posts: 31
ldivx

If you run AutoCrop with preview=false, then AviSynth will update it's built in width and height variables appropriately. Then you can use a function like the one below to set the new width and have the height calculated to main aspect ratio.

Sample Usage:

ResizeMaintainAspectWidth(384,"BiCubicResize")

That will call BiCubicResize with the width set to 384 and the height set to maintain aspect ratio.

function ResizeMaintainAspectWidth(clip c,int newwidth,string resizefn) {
nh=floor(eval(string(c.height)+". * "+string(newwidth)+". / "+string(c.width)+"."))
return eval(resizefn+"(c,"+string(newwidth)+","+string(nh)+")")
}
CropsyX is offline   Reply With Quote
Old 14th November 2002, 15:05   #10  |  Link
OUTPinged_
MooPolice 1st division
 
OUTPinged_'s Avatar
 
Join Date: Dec 2001
Location: VIlnius,LT
Posts: 448
Cropsyx, how would it deal with a movie that has several "widescreen" scenes while the movie itself is 3:4?

Also, if a movie has a "space scene" with very very low luma values in the first minute of a movie?

A suggestion:

Maybe add "frame range" using which it would detect cropping values and then use them throughout the movie...

Also, when it finished detection it is supposed to act like a regular crop. There are Crop() sources. Maybe use that so it would be a bit faster solution.
__________________
___________________MooPolice is watching you!____.o/________
OUTPinged_ is offline   Reply With Quote
Old 14th November 2002, 15:12   #11  |  Link
CropsyX
Registered User
 
Join Date: Oct 2002
Posts: 31
OUTPinged_

The way the filter works is to sample frames evenly spaced throughout the movie. It then uses the least aggressive crop settings it finds from the frames sampled. This should in theory handle both your possible problem areas. If there is any evidence that it doesn't I'll look into possible alternatives.

With regards to speeding up the cropping I need to have a look at the how avisynth does it's cropping. That and aspect ratio's are the two main things I want to finish before a 1.0 release.
CropsyX is offline   Reply With Quote
Old 14th November 2002, 15:57   #12  |  Link
OUTPinged_
MooPolice 1st division
 
OUTPinged_'s Avatar
 
Join Date: Dec 2001
Location: VIlnius,LT
Posts: 448
Can you still implement "manual" crop sample selection? It's not that complex and will be helpfull in "hard" cases(ie dark short clips).

It worked ok on my 2 test files but i am still afraid to use it blindly :-) The reason is, it is one more step for a fully automated and full proof encoding and i really want it to work best, it's a great idea.
__________________
___________________MooPolice is watching you!____.o/________
OUTPinged_ is offline   Reply With Quote
Old 14th November 2002, 15:59   #13  |  Link
OUTPinged_
MooPolice 1st division
 
OUTPinged_'s Avatar
 
Join Date: Dec 2001
Location: VIlnius,LT
Posts: 448
Erm... more on that:

Can it calculate average brightness for a frame and, if all frames have av. brightness lower than threshold, increase "samples" value and recalc?
__________________
___________________MooPolice is watching you!____.o/________
OUTPinged_ is offline   Reply With Quote
Old 14th November 2002, 16:47   #14  |  Link
CropsyX
Registered User
 
Join Date: Oct 2002
Posts: 31
Quote:
Can you still implement "manual" crop sample selection? It's not that complex and will be helpfull in "hard" cases(ie dark short clips).
I could, I'm not sure I see the point though By the time you have to manually specify a range of frames to sample it wouldn't be much more difficult to set the cropping information manually. If there's further demand for the feature I'll add it but I'm wary of adding to many parameters to AutoCrop (I'm up to 9 already).

Quote:
Can it calculate average brightness for a frame and, if all frames have av. brightness lower than threshold, increase "samples" value and recalc?
Unless you specify a really high threshold it's unlikely that from 10 frames none of them will have a enough lines to achieve a crop.

I'm sure there will be problems with the way autocrop deals with various sources but until there are concrete examples I think it will be better to add needed features than try to avoid problems no one has encountered.

Quote:
It worked ok on my 2 test files but i am still afraid to use it blindly :-)
Good choice, I'd always advise looking at the output of AutoCrop before committing to an encode. Realistically if AutoCrop fails it's not the end of the world. It just adds a couple of minutes to the setup time for an encode.
CropsyX is offline   Reply With Quote
Old 14th November 2002, 19:44   #15  |  Link
OUTPinged_
MooPolice 1st division
 
OUTPinged_'s Avatar
 
Join Date: Dec 2001
Location: VIlnius,LT
Posts: 448
Well if you would be able to make it's speed comparable to Crop(), i guess everyone here will use it :-)

Dont know about you guys, but i'm sick inputting crop values for 9999th time :/
__________________
___________________MooPolice is watching you!____.o/________
OUTPinged_ is offline   Reply With Quote
Old 25th November 2002, 05:07   #16  |  Link
jorel
Guest
 
Posts: n/a
i get a briliant thin line in the bottom!
(just like double line)
anyone get too?
  Reply With Quote
Old 26th November 2002, 10:24   #17  |  Link
neopholus
Registered User
 
Join Date: Nov 2002
Posts: 24
AutoCrop in DVD2SVCD

Hi,

if you want to use AutoCrop in DVD2SVCD have a look here or here.
neopholus is offline   Reply With Quote
Old 5th December 2002, 21:40   #18  |  Link
bilu
Registered User
 
bilu's Avatar
 
Join Date: Oct 2002
Location: Portugal
Posts: 1,182
How about a YV12 version ?
bilu is offline   Reply With Quote
Old 11th December 2002, 06:50   #19  |  Link
CropsyX
Registered User
 
Join Date: Oct 2002
Posts: 31
Quote:
Originally posted by bilu
How about a YV12 version ?
I do plan to write a YV12 version of the filter at some stage. However I
probably won't start on it until AviSynth 2.5 is released or is at least at
a relatively stable beta level. There will probably be one or two more
releases of AutoCrop for YUY before then. I have a few features I'm keen to implement before I tackle YV12.
CropsyX is offline   Reply With Quote
Old 7th January 2003, 22:20   #20  |  Link
wotef
Registered User
 
wotef's Avatar
 
Join Date: Apr 2002
Posts: 272
cropsyx, i love this filter!

really looking forward to an avisynth 2.5 release! if you're still around!
wotef 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 02:30.


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