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 4th August 2002, 12:36   #1  |  Link
bb
Moderator
 
bb's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 2,665
Converter for VDub->AviSynth cuts and crops

Hi,

I got bored converting the VirtualDub "AddRange" into AviSynth "Trim" commands, and VirtualDub "SetClipping" into AviSynth "Crop".

So I wrote this tiny program to do the work for me. Maybe someone else will find it useful.

(see attachment)


bb

Last edited by bb; 16th January 2003 at 07:42.
bb is offline   Reply With Quote
Old 4th August 2002, 12:47   #2  |  Link
Koepi
Moderator
 
Koepi's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 4,455
Too bad i can't verify it as this isn't "my" forum

Well, that saves some time, nice job!

Regards,
Koepi
Koepi is offline   Reply With Quote
Old 4th August 2002, 15:20   #3  |  Link
dividee
Registered User
 
Join Date: Oct 2001
Location: Brussels
Posts: 358
I didn't test it yet, but just by reading the readme:
Quote:
VirtualDub: SetClipping(x1, y1, x2, y2)
AviSynth: crop(x, y, width-1, height-1)
avisynth crop is crop(x,y,width,height), no -1 involved.

Since avisynth 2.0.? you can use negative values for crop width and height that will be interpreted as distance from the right and bottom border; vdub parameters will map to Crop(x1,y1,-x2,-y2).

Maybe we could do the same for Trim, were a negative value would mean 'framecount' instead of 'last frame' ?
__________________
dividee
dividee is offline   Reply With Quote
Old 4th August 2002, 16:47   #4  |  Link
bb
Moderator
 
bb's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 2,665
Thank you for the flowers, Koepi, but this is just a quick'n dirty small CLI. Nothing famous, but I thought I'd share it with you.

@dividee:
If you have a 640x576 captured source, and you want to crop let's say 80 pixels from top and bottom, wouldn't the crop statement be:

Crop(0, 80, 639, 495)

instead of Crop(0, 80, 640, 496)? I think width and height are somehow "zero-based". Please correct me, if I'm wrong (because then I'd quickly change the proggie).

Regarding the negative values for the third and fourth parameters, I don't use them, which doesn't hurt and helps the compatibility with earlier versions of AviSynth.

I second the idea of modifying the Trim statement's syntax. Keep in mind that "last frame" is "first frame" + "framecount" - 1 (here is it again, the -1).


bb

Last edited by bb; 4th August 2002 at 16:50.
bb is offline   Reply With Quote
Old 4th August 2002, 17:26   #5  |  Link
Koepi
Moderator
 
Koepi's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 4,455
the values are correct in vdub and not 0 based.

regards,
Koepi
Koepi is offline   Reply With Quote
Old 4th August 2002, 17:28   #6  |  Link
bb
Moderator
 
bb's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 2,665
Hi Koepi,

you mean it should be Crop(0, 80, 640, 496) in my example above?
(Damn, I would try it myself, but I'm capturing Star Trek (TOS) at the moment.)


bb
bb is offline   Reply With Quote
Old 4th August 2002, 17:50   #7  |  Link
Koepi
Moderator
 
Koepi's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 4,455
bb,

yes, ex-actly

That's how I create my avisynth scripts and this never failed.

Regards,
koepi
Koepi is offline   Reply With Quote
Old 4th August 2002, 18:11   #8  |  Link
bb
Moderator
 
bb's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 2,665
I feel stupid...
Ok, here's the update, now using width, height instead of width-1, height-1

bb

Last edited by bb; 16th January 2003 at 07:42.
bb is offline   Reply With Quote
Old 4th August 2002, 18:20   #9  |  Link
dividee
Registered User
 
Join Date: Oct 2001
Location: Brussels
Posts: 358
I'll make the change in avisynth:
trim(100,-100)
will be the same as
trim(100,199)

Note that previously you couldn't easily keep only the first frame of a clip, as 0 for lastframe means end-of-clip:
trim(0,0) is the same as trim(0,last.framecount-1)

With the new syntax you could do it with clip(0,-1).
__________________
dividee
dividee is offline   Reply With Quote
Old 5th August 2002, 19:07   #10  |  Link
bb
Moderator
 
bb's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 2,665
Another small update: will now put all Trim(...) statements into a single line (otherwise AviSynth won't process it). I'm planning on an auto-insert function which fill fill in a placeholder in an AVS template with the cuts and crops. This way you can create your favourite script, insert a placeholder like <<<cuts/crops>>>, feed this template into vcf2avs, and you're ready to go.

Anybody interested?

bb

Last edited by bb; 16th January 2003 at 07:41.
bb is offline   Reply With Quote
Old 11th August 2002, 08:59   #11  |  Link
bb
Moderator
 
bb's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 2,665
Fixed another stupid bug... Next time I'll test more before I post a proggie, promised!

bb
bb is offline   Reply With Quote
Old 10th January 2003, 19:10   #12  |  Link
bb
Moderator
 
bb's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 2,665
I finally found the time to code a few more lines in C++, so here's the result:

Code:
vcf2avs_gui beta 6
What's new?
- It recognizes VirtualDub's resize filter and adds a SimpleResize command accordingly.
- It has a GUI.

Have fun!

bb

Last edited by bb; 14th January 2003 at 15:58.
bb is offline   Reply With Quote
Old 14th January 2003, 07:16   #13  |  Link
bb
Moderator
 
bb's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 2,665
There's a bug in vcf2avs_gui beta 6: The last trim command is applied twice for some reason. Just delete the last trim and you're ok. I'll upload a corrected version as soon as possible.

(11 downloads and nobody noticed? Strange...)

bb
bb is offline   Reply With Quote
Old 14th January 2003, 18:27   #14  |  Link
bb
Moderator
 
bb's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 2,665
Here we go: I killed the stupid bug. Sorry for the inconvenience.

bb

Last edited by bb; 25th January 2003 at 13:58.
bb is offline   Reply With Quote
Old 15th January 2003, 07:31   #15  |  Link
bb
Moderator
 
bb's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 2,665
Any comments?

bb
bb is offline   Reply With Quote
Old 15th January 2003, 09:34   #16  |  Link
vidiot
Registered User
 
Join Date: Nov 2001
Location: Germany
Posts: 144
Will be helpful for my tv captures...
I used your tool from the first time (the commandline one)
-> itīs just easier than using a calculator to convert vcF 2 avs!

Very helpful - thank you!

Harald
vidiot is offline   Reply With Quote
Old 16th January 2003, 17:53   #17  |  Link
trbarry
Registered User
 
trbarry's Avatar
 
Join Date: Oct 2001
Location: Gainesville FL USA
Posts: 2,092
Very sweet!

So far I've just read the readme, haven't run it because of a question ...

I usually do HDTV caps and keep the ac3 sound, muxing it into the avi after encoding. Then I trim out commercials. However this is a wasteful habit because it means I wait (sleeping) while encoding about 50% more than I need and then throw it away.

But the sound has to be added of course before I clip out commercials. I'm not sure how to use vcf2avs and accomplish this. Anybody know? (assuming I still want to keep ac3)

Maybe I'm just asking again for direct audio copy in Avisynth, or maybe there is another answer.

- Tom
trbarry is offline   Reply With Quote
Old 16th January 2003, 20:50   #18  |  Link
stax76
staxrip & mpv.net
 
Join Date: Jun 2002
Posts: 5,247
Quote:
I usually do HDTV caps and keep the ac3 sound, muxing it into the avi after encoding.
Then I trim out commercials. However this is a wasteful habit because it means I wait (sleeping)
while encoding about 50% more than I need and then throw it away.
I did once put a riff header to the AC3, used delete selection in VD and then encodet it and it worked fine. But I did it only once for testing my prog DVX, I don't use AC3 myself. What about VDMod, can't you just open AC3, cut and encode, encoding the advertising ain't a very good solution, perhaps make just a feature request for VDMod, a lot coders working on this great Mod

BTW: the avs editor in DVX (3.0 RC5 can be dowmloaded in the forum) has also a VD to Trim converter, but I think VDMod is the best way to cut, I've coded the converter only to be able to make a comp test after I've cutted with VD

'Dolemite
__________________
staxrip is in need of a new maintainer since I would like to retire.
stax76 is offline   Reply With Quote
Old 16th January 2003, 21:27   #19  |  Link
trbarry
Registered User
 
trbarry's Avatar
 
Join Date: Oct 2001
Location: Gainesville FL USA
Posts: 2,092
Quote:
I did once put a riff header to the AC3, used delete selection in VD and then encodet it and it worked fine. But I did it only once for testing my prog DVX, I don't use AC3 myself. What about VDMod, can't you just open AC3, cut and encode, encoding the advertising ain't a very good solution, perhaps make just a feature request for VDMod, a lot coders working on this great Mod
It is indeed a great mod, and what you suggests works. I've even used it that way.

I guess the main thing that bothers me is that HDTV caps often can contain enough garbage in them that vdub/avisynth can crash. It is a pain to cut commercials out of a 3 hour movie and then have to do it again.

So my main problem is probably just ignorance of vdub. What do you save and load again to have the cuts back so you don't have to cut again on a 2nd try? Is the cut data always saved when you save processing settings?

- Tom
trbarry is offline   Reply With Quote
Old 16th January 2003, 22:26   #20  |  Link
stax76
staxrip & mpv.net
 
Join Date: Jun 2002
Posts: 5,247
VD saves and loads everything except files but they can be opened easily by hand. VDMod saves also audio files. Using delete selection you will find a VirtualDub.subset.AddRange methods for each block in your script.

'Dolemite
__________________
staxrip is in need of a new maintainer since I would like to retire.
stax76 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 16:32.


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