Log in

View Full Version : should I do it in avisynth script or via virtualdub?


lancer
21st January 2003, 17:48
speed can be everything but my system seems to have settled down to a consistent 3-4.5 fps when taking my capture and turning it into an intermediate file.

Here is my main script.


a = OpenDMLSource("d:\capture.00.avi")
b = OpenDMLSource("d:\capture.01.avi")
AlignedSplice(a, b)
ConvertToYUY2()
Letterbox(104, 104)
Loadplugin("d:\convolution3d.dll")
Loadplugin("d:\decomblegacy.dll")
#Convolution3d (preset="movieLQ")
Convolution3D (0, 32, 128, 16, 64, 10, 0)
Telecide(guide=1, post=true)
Decimate(cycle=5)

Now in Virtualdub I normally

adjust the saturation slightly, bring the brightness down about 3% and up contrast 2%. then I resize to 720x680 and then null transform and crop 106 top, 94 bottom back to 720x 480. so I have a pseudo anamorphic widescreen 2.35:1 file with a bit of black border top and bottom. I need the border to be there because there is some burned in subtitle present that needs to be retained.

Then I did some more reading on avisynth.org and see that I could bicubic or bilinear in script, but also add borders and crop etc in script too.

which would be faster, script doing it or virtualdub? second. I see avisynth has Tweak for brightness and contrast etc. but again, would virtualdub do it quicker and also, is my ordering okay? I know that the order you do certain things can have an affect on your output speed.

wotef
21st January 2003, 18:04
you don't state what cpu you have, but 3-4fps is painful
why do you perform NTSC 3:2 pulldown? don't you have a pal source?
oh, script can be faster to replicate your vdub operations
...but there's quite a few odd things in your script already...

for example,
try using avisource instead of opendmlsource
do you really need the converttoyuy2? try eliminating it
if you're going to pulldown, do it (telecide, decimate) immediately after alignedsplice
tweak and c3d and then your resize-business, e.g.

loadplugin("d:\convolution3d.dll")
loadplugin("d:\decomb.dll")
a=avisource("d:\capture.00.avi")
b=avisource("d:\capture.01.avi")
a++b
telecide(guide=1)
decimate()
tweak(bright=-3,cont=1.02,sat=1.1)
convolution3d(0,32,128,16,64,10,0)
letterbox(104,104)
bicubicresize(720,680,0,0.5)
crop(0,106,-0,-94)

--> then fast recompress to virtualdub

you could probably also optimise your resizing if you could indicate what your original source capture image is

and damn, that must be a cruddy source for c3d settings that high

lancer
21st January 2003, 18:15
I decomb because I have a 29.97 NTSC source I want to pull back to 23.976 progressive.

convolution gets rid of the noise and letterbox gives me solid black borders.

bb
22nd January 2003, 07:41
Somehow I feel the commands have to be re-ordered a bit: crop should come first, then resize, then letterbox (with different parameters, of course).
And instead of the clumsy
a=avisource("d:\capture.00.avi")
b=avisource("d:\capture.01.avi")
a++b
you should use
SegmentedAviSource("D:\capture.avi")
(yes, that's correct: without the ".00")

And it will definitely be faster in AviSynth than in VirtualDub, provided that your source in not in RGB colorspace.

Edit: how come there's no Trim command? No frames to throw away in a captured video?

bb

lancer
22nd January 2003, 10:15
*hang head in shame*

can't figure it out. can get it to cut stuff from the begining

Trim(100,0) for example, but can't figure how I also trim off the end

doh!

bb
22nd January 2003, 10:29
Two options:
Trim(clip clip, int first_frame, int last_frame)
Trim(clip clip, int first_frame, int -num_frames)
So if you want to cut frames 100...199 from your video (a total of 100 frames), use either
Trim(100, 199)
or
Trim(100, -100)


bb

lancer
22nd January 2003, 16:16
now I get it. okay. we rock. and now I've got tweak figured I can do it all in script and not in virtual dub.

for information.

my machine is a PIII 733 running 512mb PC100 SDRAM and a Ultra 100 Maxtor 80GB Hard Drive to capture and make files with. the source is captured at 704 x 480 with huffyuv.

my throughput using vdub is 3-4 fps on a frameserve if I directly recompress now that I can do it all in script I might get a better frame rate.

so, my script should now look as follows

loadplugin("d:\convolution3d.dll")
loadplugin("d:\decomb.dll")
SegmentedAviSource("D:\capture.avi")
Trim(0,0-1) ++ Trim(283+1,0)
Trim(0,86000) ++ Trim(86211+1,0)
telecide(guide=1, post=true)
decimate()
tweak(bright=-3,cont=1.02,sat=1.3)
#convolution3d(0,32,128,16,64,10,0)
Convolution3d (preset="movieLQ")
letterbox(48,48)
bicubicresize(720,480,0,0.5, 0, 0, 704, 368)
#crop(0,106,-0,-94)

I assume I trim before I telecide etc. otherwise I waste time IVTC and convoluting frames I'm cutting out anyway? I've ketp the post=true on decomb because I get slightly better results with it with my NTSC source. unless I'm missing a trick here and it's on by default which is why you took it off the script?

the final addition would be my subtitles. sample line below.

Subtitle("senor - no one has ever come out of there alive", first_frame=2140, last_frame=2221, x=-1, y=460, size=28, text_color=$ffFFff)

for resize, I saw on avisynth.org that if I combine source sizes with the resize it would act like a crop so as a result it is faster. so I can comment out the crop and achieve the same result?

bb
23rd January 2003, 07:45
If you have trouble with getting the correct trims, just cut your video in VirtualDub, then save a .VCF file (Save processing settings), then use my vcv2avs proggie to convert to a .AVS file with trims, crop, and resize. Search for the file on the forums, you'll find it (as well as D$'s program, which has the same name).

bb

Richard Berg
23rd January 2003, 07:58
I have to say, I really hate the naming of the Trim() function. It does the exact opposite of what it implies.

bb
23rd January 2003, 08:40
Why? Trim(100, 199) trims the file so that only frames from 100 to 199 remain. If you'd call it "Cut(100, 199)" I would assume that frames 100 - 199 were thrown away, so that frames 0 - 99 and 200 - end remained.

bb

lamer_de
23rd January 2003, 12:12
If you have trouble with getting the correct trims, just cut your video in VirtualDub, then save a .VCF file (Save processing settings), then use my vcv2avs proggie to convert to a .AVS file with trims, crop, and resize.
Thanks bb, i didn't knew that such a tool exists. Very helpfull.
BTW, it's called

VCF2AVS

The search with vcv2avs delivers no usable results ;)

CU,
lamer_de

bb
23rd January 2003, 12:43
Originally posted by lamer_de
BTW, it's called

VCF2AVS

The search with vcv2avs delivers no usable results
:eek:

Stupid typo...

bb

lancer
23rd January 2003, 16:52
thanks for the tool BB. saves me a headache or two! taking my purple line problem into account in tmpgenc something else also occured to me.

why bother having an image 704 x 480 high when I only want to process the image bits and not the border anyway? so (see highlights in red)

to the script brains here does this make sense

load plugins, load video, splice, crop the bars off, run tweak and convolution then resize to pseudo anamorphic and add borders to make it up to 480 in height. so when it decimates, convolutes etc it is only doing an image about 260ish high instead of 480

loadplugin("d:\convolution3d.dll")
loadplugin("d:\decomb.dll")
a = OpenDMLSource("j:\2gbsegmenttest.00.avi")
b = OpenDMLSource("j:\2gbsegmenttest.01.avi")
AlignedSplice(a, b)
Crop(0,110,-0,-110) #= 260 high for film
telecide(guide=1, post=true)
decimate()
tweak(bright=-3,cont=1.01,sat=1.15)
#convolution3d(0,32,128,16,64,10,0)
Convolution3d (preset="movieLQ")
bicubicresize(704,368) # that is anamorphic high
AddBorders(0,56,0,56) # borders to make it up to 480

oh, I know it is opendml source still but for some reason my avisynth 2.07 doesn't like to run segmentedavisource and is also very picky and case sensitive on the commands to run.

Richard Berg
23rd January 2003, 16:54
Originally posted by bb
Why? Trim(100, 199) trims the file so that only frames from 100 to 199 remain. If you'd call it "Cut(100, 199)" I would assume that frames 100 - 199 were thrown away, so that frames 0 - 99 and 200 - end remained.

bb
Perhaps it's a dialect thing, but to me "Trim" and "Cut" are synonymous.

bb
23rd January 2003, 17:58
Originally posted by Richard Berg
Perhaps it's a dialect thing, but to me "Trim" and "Cut" are synonymous.
So what would you suggest?

bb

wotef
23rd January 2003, 18:23
try fitcd (http://shh.dvdboard.de/fitcd.html) for no-brainer standards-compliant resizing

i'd put c3d before the resize

lancer
23rd January 2003, 20:33
and getting back on topic, anyone care to comment on my follow up.

theReal
24th January 2003, 21:23
telecide(guide=1, post=true) I thought the default was "post=true" and you only need to set the "post" parameter if you want it to be false. I'm not 100% sure, though (but 98% ;))

Belgabor
24th January 2003, 22:30
Originally posted by bb
If you have trouble with getting the correct trims, just cut your video in VirtualDub, then save a .VCF file (Save processing settings), then use my vcv2avs proggie to convert to a .AVS file with trims, crop, and resize. Search for the file on the forums, you'll find it (as well as D$'s program, which has the same name).

bb

It's in fact much easier (imho) in VDubMod.

Asmodian
24th January 2003, 23:23
@lancer
That script looks great to me and I like to think of myself as somewhat competent when it comes to Avisynth scripts :)
You might want to try avisource instead of OpenDMLSource (if it works) since SegmentedAviSource doesn't work for you, I am not sure which is faster.
I also believe that doing the crop in the resize is not actually faster (if anyone knows different please tell me) but that doesn't usually matter because one usually wants to do filtering after the crop but before the resize. You could still do a trim before the crop but I don't think that would be faster then just cutting in vdub.
ps. make sure to use fast recompress in vdub! color space conversions are bad (and slow!), the other modes convert to RGB (except for direct stream copy obviously).

lancer
5th February 2003, 16:20
@asmodian

thanks for the heads up guys. seeing as my script appears to be all in the right order then it's disappointing. Avisynth is no faster than doing it in virtualdub anyway, but it does look slightly better.

on the resize. I found I could capture cropped with no frame loss at

704 x 274

so I can dump the crop command in the script, just resize and add borders so I resize to 704 x 360 and add borders 72 at top and 48 at bottom. this keeps to multiples of 16 to cut down on DCT blocks correct?

I would assume because it is only being resized by height and not width that a bilinear resize would be okay? or would I be fine just sticking with Bicubic. I thought bilinear was faster?

theReal
6th February 2003, 12:27
If you're concerned about speed, then you should use SimpleResize().
It's a bilinear resizing algo, and it's the fastest I know of