View Full Version : 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
Koepi
4th August 2002, 12:47
Too bad i can't verify it as this isn't "my" forum ;)
Well, that saves some time, nice job!
Regards,
Koepi
dividee
4th August 2002, 15:20
I didn't test it yet, but just by reading the readme:
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' ?
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
Koepi
4th August 2002, 17:26
the values are correct in vdub and not 0 based. :)
regards,
Koepi
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
Koepi
4th August 2002, 17:50
bb,
yes, ex-actly :)
That's how I create my avisynth scripts and this never failed. :)
Regards,
koepi
I feel stupid...
Ok, here's the update, now using width, height instead of width-1, height-1
bb
dividee
4th August 2002, 18:20
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).
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
bb
11th August 2002, 08:59
Fixed another stupid bug... Next time I'll test more before I post a proggie, promised!
bb
bb
10th January 2003, 19:10
I finally found the time to code a few more lines in C++, so here's the result:
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
bb
14th January 2003, 07:16
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
14th January 2003, 18:27
Here we go: I killed the stupid bug. Sorry for the inconvenience.
bb
bb
15th January 2003, 07:31
Any comments?
bb
vidiot
15th January 2003, 09:34
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
trbarry
16th January 2003, 17:53
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
stax76
16th January 2003, 20:50
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
trbarry
16th January 2003, 21:27
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
stax76
16th January 2003, 22:26
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
sillKotscha
17th January 2003, 00:55
ehrm bb,
what about this nice little one by D$... vcf - avs conversion tool - edit captures in vdub (http://forum.doom9.org/showthread.php?s=&threadid=41927) (even the name seems to be the same :confused: )
and for the germans...
discussion here (http://forum.doom9.de/viewtopic.php?t=4229)
maybe D$ and you can merge your ideas...
bb
17th January 2003, 08:54
sillKotscha,
yes, I know, and I talked to him already in this thread (just giving some hints):
http://forum.doom9.org/showthread.php?s=&threadid=37995
And TheWEF recommends it in the GordianKnot forum:
http://forum.doom9.org/showthread.php?s=&threadid=41927
But, you know, I coded my proggie a long time before D$ started his efforts, and I primarily coded it for myself. And furthermore it's written in VC++, whereas D$ uses Delphi.
But there are two more reasons why we probably don't get together:
1. I don't have much time to code (unfortunately, although I'd love to).
2. I'm planning to walk a different path than D$: My vcf2avs shall stay a real script converter, and it should be able to transform any VirtualDub filter / filter setting into an AviSynth equivalent one day. With a configurable filter mapping and such.
bb
Darksoul71
17th January 2003, 15:59
@bb:
If I had known about your tool be4 I would have spent my time in developing VCF2AVS :)
Anyway, VCF2AVS is more a side product of my DVAVI2MiniDVD which I might release in future.
cu,
D$
bb
18th January 2003, 18:17
Darksoul71,
please keep up the good work. I appreciate your program, and it's always better to have a choice. I don't see your VCF2AVS as a competition. Maybe I wouldn't have coded mine if you had coded yours earlier... But as I said, I believe I have a different goal: to create a converter where you just load a VCF file and get an equivalent AVS file as output. Filters would be replaced to their AviSynth equivalents, if they exist, or to a similar filter (configurable choice).
That's my idea. The trim converter was a first step only, but it was important for me, because it makes my capture life easier.
bb
vidiot
18th January 2003, 22:27
Originally posted by Darksoul71
@bb:
Anyway, VCF2AVS is more a side product of my DVAVI2MiniDVD which I might release in future.
cu,
D$
Did I read right (short: DV 2 Mini DVD)...?
Please do so: release it!:cool:
Harald
bb
24th January 2003, 23:59
Here's beta 8. Some GUI cleanup. If you always wondered why the GUI disappeared after pressing Enter, or if why you could enter the file paths and names through the file selection boxes, but not by directly typing them in: feel free to download the corrected version.
bb
bb
1st February 2003, 14:38
Ok, I don't get much feedback (if any) :(
But still, there were 30 downloads of beta 8, so I guess someone uses it: here's beta 9. Some nice improvements, I guess.
- Writes complete AviSynth files now ready for use.
- Automatically detects single or segmented sources and adds
AviSource or SegmentedAviSource accordingly.
- Adds a Telecide() command, if you leave the "remove combing"
checkbox checked.
- Automatically fills in the AVS filename after selecting the
VCF file (for your conveniance, you may change it, of course).
bb
^^-+I4004+-^^
2nd February 2003, 18:19
ok,this is very usefull stuff no matter who thought of it first
(hehe)....
D$ version... ( this one:
"VCF2AVS_Trim V1.1 by Dark$oul71
===============================
Update:
=======
Fixed a small bug because I calculated the start
frame in AVISynth wrong.
Thanks to bb for pointing out :)" )
...stil has a bug and it's making 1frame offset (1 frame more on every cut.....better more then less,but still it's not frame accurate..)
did a test in which i edited with VD,saved vcf,converted to avs etc.
avs version is longer (that made me suspicious), and indeed i noticed that on every cut vcf2avs is adding one more frame (that is not in original .vcf file )
all right now i'll dload this one to see how it goes.......
btw. thanks for this stuff as it's really much easier to edit raw video in VD,save vcf and convert to avs than to cut that avs in VD..( as that is slow... not near as snappy as VD's editor as avs is more of an processing than editing tool,because it lacks GUI..)
bb
2nd February 2003, 19:05
Just found that there's a tiny bug in beta 9: If a SegmentedAviSource command is created, the counter is not stripped off the filename, so you have to delete the three characters manually, e.g.:
vcf2avs_gui creates
SegmentedAviSource("C:\Movie\JamesBond.00.avi")
so change it to
SegmentedAviSource("C:\Movie\JamesBond.avi")
Will be corrected in beta 10 as soon as possible.
bb
bb
2nd February 2003, 19:56
Ok, here's the bugfix (beta 10).
bb
^^-+I4004+-^^
2nd February 2003, 21:38
your segmentedavisource syntax is not right:
vcf2avs_gui.exe gives "SegmentedAviSource("D:\Video\Raw_Stuff\clubrnb_.00.avi")
Trim(0,4440)"
while it should be:"SegmentedAviSource("D:\Video\Raw_Stuff\clubrnb_.avi")
Trim(0,4440)"
ie. segment number (or sequel start "00")
should be removed so only base name
is left..(clubrnb_.avi).....
avs205 cannot open first avs statement.....
it can open the second one.....
hope you can adress this issue.....
cheers
Ivo
[edit:you are FAST!LOL!.....sems like we noticed this bug
at same time....as this wasn't here few hrs ago.....
good call! let me now try this one]
McQuaid
2nd February 2003, 22:02
I haven't tried this utility yet as I do my edits in TMPGENC for mpeg encoding, but this will be handy for doing divx/xvid edits.
I used to frameserve from avisynth > vdub > tmpgenc, just to get the editing abilities of vdub when tmpgenc only allowed one cut. But now tmpgenc's editing is much better than vdub. It has the convenience of edited selected or everything except selected, but the main thing is being able to see the audio.
Prior to that I would always get those audio blips from time to time when editing commericals while using vdub.
Is there some way to have avisynth show a visualization of the audio in vdub?
I wish Avery Lee would consider adding this functionality to vdub.
bb
3rd February 2003, 09:59
Originally posted by ^^-+I4004+-^^
[edit:you are FAST!LOL!.....sems like we noticed this bug
at same time....as this wasn't here few hrs ago.....
good call! let me now try this one]
You don't use the reload button very often, do you? ;)
Anyway: thanks for the feedback.
@McQuaid:
I use it for SVCD encoding from TV captures, too. Audio visualization is not yet available neither in AviSynth nor in VirtualDub, as far as I know. But there have been some posts about this topic recently, e.g. a request to enhance the AviSynthMonitor filter accordingly. Don't know if anybody's currently working on it, though.
bb
^^-+I4004+-^^
3rd February 2003, 13:27
>You don't use the reload button very often, do you?
offline reply...hit "submit" to connect and here we are...(hehe)
let's see 1b....
(let me add:it's really SMALL! nice job..)
Somehow the attachment vanished...
Here it is again:
bb
bb
11th November 2003, 18:47
Here's the same program, but this time with the readme included.
bb
bb
18th November 2003, 10:04
To keep you busy downloading ;) here's a convenience update:
After selecting the captured AVI file the "original size" X and Y fields will be filled in automatically by reading the AVI header. You can still enter the values manually, though.
Sincerely
bb
bb
19th November 2003, 18:21
Eleven downloads and not a single comment...
I assume you download the proggie just to delete it again?
bb
vidiot
23rd November 2003, 22:04
@ bb:
I did use your tool before Vdubmod came up.
If somebody does only cuts and trims itīs easy:
You can "open video file via avisynth" -> do your cuts and trims
->open the script editor and "insert trims as frame set".
Works like a charm, - at least for me.
But thank you for your tool - it could to be a "lifesaver" (isnīt that a kind of candy in the states?)especially when you realize that you did your trims in VD "original" or opened your video in VDMod via
"open video".:rolleyes:
vidiot
DDogg
26th November 2003, 16:31
Hmmm, could somebody using VDub 1.5.9 check and see if the ranges are being saved in the vcf file? It is not saving them for me whereas VDubMod is. Could be just a silly error on my part.
vidiot
26th November 2003, 20:59
Originally posted by DDogg
Hmmm, could somebody using VDub 1.5.9 check and see if the ranges are being saved in the vcf file? It is not saving them for me whereas VDubMod is. Could be just a silly error on my part.
WTH is that?
DDogg youīre right - or`Iīm as silly as youīre...:D
That what a quick test gave me:
VirtualDub.audio.SetSource(1);
VirtualDub.audio.SetMode(0);
VirtualDub.audio.SetInterleave(1,500,1,0,0);
VirtualDub.audio.SetClipMode(1,1);
VirtualDub.audio.SetConversion(0,0,0,0,0);
VirtualDub.audio.SetVolume();
VirtualDub.audio.SetCompression();
VirtualDub.audio.EnableFilterGraph(0);
VirtualDub.video.SetDepth(24,24);
VirtualDub.video.SetMode(3);
VirtualDub.video.SetFrameRate(0,1);
VirtualDub.video.SetIVTC(0,0,-1,0);
VirtualDub.video.SetCompression();
VirtualDub.video.filters.Clear();
VirtualDub.audio.filters.Clear();
I couldn'tīt see the cuts either...
Maybe because I work with VD Mod only I wouldnīt have noticed that issue - thanks for letting us know.
stickboy
26th November 2003, 22:05
Originally posted by DDogg
Hmmm, could somebody using VDub 1.5.9 check and see if the ranges are being saved in the vcf file? It is not saving them for me whereas VDubMod is. Could be just a silly error on my part. In VirtualDub 1.5.9, when you select Save Processing Settings, you need to check the "Include Selection and Edit List" checkbox.
bb
27th November 2003, 08:22
The same applies to VirtualDub 1.5.8. Stupid, if you ask me...
bb
DDogg
2nd December 2003, 18:51
Silly of me to miss that new checkbox. Thanks for being gentle :)
bb, this tool is great and thanks for doing it. I would think it would be indispensable for anybody doing capture that use VDub to edit out commercials. Maybe one of the folks doing the capture FAQ could add a link.
Wilbert
2nd December 2003, 22:35
Maybe one of the folks doing the capture FAQ could add a link.
But, there is a link to this thread!
Stabmaster-Arson
16th January 2004, 08:09
This is fantastic, exactly what I was looking for.
Now a suggestion, a really easy thing to add to this: Checkboxes for mpeg2source, mpegsource, directshow source (If you are going to add one, make it mpeg2source :)
As an addition to checkboxes for common sources, how about an input box for a custom typed source?
(What I personally really want is the mpeg2source but I'm sure tohers would apreciate other sources too)
TRhis will save me from virtually any manual editing.
Cheers
-Stab
bb
16th January 2004, 08:41
I was thinking of a user template, an avs script with placeholders where vcf2avs would include its information. I'll extend the program as soon as I get the time. Thanks for the feedback by the way.
bb
bb
19th January 2004, 20:33
Here's vcf2avs beta 12.
- DVD2AVI project files can now be opened, too. You have to
verify / adjust the original size X/Y parameters manually.
- The Telecide command has been changed to "Telecide(guide=2)".
- Denoising via Convolution3D is now automated, too.
Have fun!
@Stabmaster-Arson: I hope this is a step towards what you desire :)
bb
RonaldMac
5th February 2004, 21:53
Hi bb,
first of all, your proggie is a wonderful idea!
But til now I had no luck, made my settings in Vdub and the vdr-file was:
VirtualDub.audio.SetSource(1);
VirtualDub.audio.SetMode(0);
VirtualDub.audio.SetInterleave(1,500,1,0,0);
VirtualDub.audio.SetClipMode(1,1);
VirtualDub.audio.SetConversion(0,0,0,0,0);
VirtualDub.audio.SetVolume();
VirtualDub.audio.SetCompression();
VirtualDub.audio.EnableFilterGraph(0);
VirtualDub.video.SetDepth(24,24);
VirtualDub.video.SetMode(3);
VirtualDub.video.SetFrameRate(0,1);
VirtualDub.video.SetIVTC(0,0,-1,0);
VirtualDub.video.SetRange(0,0);
VirtualDub.video.SetCompression();
VirtualDub.video.filters.Clear();
VirtualDub.video.filters.Add("deinterlace");
VirtualDub.video.filters.instance[0].Config(0);
VirtualDub.video.filters.Add("logoaway v4.0beta3");
VirtualDub.video.filters.instance[1].Config( 6, 6553610, 5570710, 0, 0, 5, 1, 66051, 0, 1, "", "", "");
VirtualDub.video.filters.Add("null transform");
VirtualDub.video.filters.Add("resize");
VirtualDub.video.filters.instance[3].Config(320,240,3);
VirtualDub.audio.filters.Clear();
VirtualDub.subset.Delete();
Then I ran vcf2avs and my avisynth-file looked like that:
AviSource("C:\Marple.avi")
SimpleResize(320,240)
Convolution3D(1, 6, 10, 6, 8, 2.8, 0)
VirtualDub.audio.SetSource(1);
VirtualDub.audio.SetMode(0);
VirtualDub.audio.SetInterleave(1,500,1,0,0);
VirtualDub.audio.SetClipMode(1,1);
VirtualDub.audio.SetConversion(0,0,0,0,0);
VirtualDub.audio.SetVolume();
VirtualDub.audio.SetCompression();
VirtualDub.audio.EnableFilterGraph(0);
VirtualDub.video.SetDepth(24,24);
VirtualDub.video.SetMode(3);
VirtualDub.video.SetFrameRate(0,1);
VirtualDub.video.SetIVTC(0,0,-1,0);
VirtualDub.video.SetRange(0,0);
VirtualDub.video.SetCompression();
VirtualDub.video.filters.Clear();
VirtualDub.video.filters.Add("deinterlace");
VirtualDub.video.filters.instance[0].Config(0);
VirtualDub.video.filters.Add("logoaway v4.0beta3");
VirtualDub.video.filters.instance[1].Config( 6, 6553610, 5570710, 0, 0, 5, 1, 66051, 0, 1, "", "", "");
VirtualDub.video.filters.Add("null transform");
VirtualDub.video.filters.Add("resize");
VirtualDub.video.filters.instance[3].Config(320,240,3);
VirtualDub.audio.filters.Clear();
VirtualDub.subset.Delete();
btw, I'm no avs-expert ;{ !
CCE didn#t like it, it brings the message:
unexpected character ";" in line 4 column 29
deleting the ";" doesn#t change anything,
what could I do??
bb
6th February 2004, 08:52
Welcome to the forum, RonaldMac :)
There are no cuts in your VCF file. Did you check the check box at the bottom left in the "Save processing settings" dialog, named "Include selection and edit list"?
bb
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.