PDA

View Full Version : I am working on a perl GUI to avisynth - Need Help


HighInBC
13th September 2005, 18:22
But I have one large problem, I have no way of loading a frame from an AVS file into the perl script.

The idea behind the perl script is it would allow you to see a frame and then use perl filters that allow you to do white balancing, motion compensation, and face blurring/tracking. The perl script would then output avs code.

What I need, is a little exe that I can go "avs2clip narf.avs --frame 150"

This would simply take frame 150 from narf.avs and place it in the clipboard. Once in the clipboard perl can display it. the file also could be saved, but clipboard would be alot faster.

I imagine simply changing the code a bit on avs2avi would do the trick, if someone could please help me with this I promise to release the perl code for anything I write that uses it.

HighInBC
13th September 2005, 18:55
The way I do this now, is to use virtualdub to export the frames to bmp's, however this is clumsy and tedious. And uses alot of HD space for larger clips, and take a long time.

If I could automate this on a frame by frame basis it would be prefered.

movax
13th September 2005, 19:38
I think there was a thread about this in Avisynth Usage forum, about exporting a single frame, either through VDub or an AVS script.

HighInBC
13th September 2005, 19:43
I am not just trying to extract an image. It is essential that a perl script(program) can do this automatically and then get the image in memory.

I read that thread, but these manual methods will not help me.

Thanks anyways

movax
13th September 2005, 19:52
Well in that case, you should be able to write a C/C++ app to do that pretty simply. :)

HighInBC
13th September 2005, 20:34
I don't know C, I know perl, and perl does not work with the VFW system because it is a multi-OS language, it does however work with the clipboard. I know it is a simple C program, but I don't know how to make a "Hello world!" C program at this point hehe.

Mabye some guru could whip one up?

HighInBC
15th September 2005, 18:05
I am currently automating the proccess with this sub:


sub grab_image
{
my $clip = shift;
my $frame = shift;

my $template =
'
VirtualDub.Open("<FILE>","",0);
VirtualDub.audio.SetSource(1);
VirtualDub.subset.Clear();
VirtualDub.subset.AddRange(<FRAME>,1);
VirtualDub.SaveImageSequence("Frame-<FRAME>-", ".bmp", 0, 0);
VirtualDub.Close();
';
$template =~ s|<FILE>|$clip|;
$template =~ s|<FRAME>|$frame|g;
open(FILE,">temp.vcf");
print FILE ($template);
close(FILE);
system('C:/DVD Tools/VirtualDub-1.5.9/VirtualDub.exe','/stemp.vcf','/x');

return "Frame-$frame-0.bmp";
}


This is a bit cumbersome but it works. Thanks anyways guys.

jonny
18th September 2005, 12:38
Hi

take a look at this:

http://jonny.leffe.dnsalias.com/enc/rar/source_1_03.rar
(original page is http://jonny.leffe.dnsalias.com - look for "Enc")

i've written a lib to get infos from avs (it show how you can use c with a perl script and link vfw)
You should learn c to get your work done in a clear way :)

and here is a only c example for frame reading:

http://jonny.leffe.dnsalias.com/doom9/avs_read.rar
It reads frames from an avs script, usage: "test.exe myscript.avs"
(maybe you could modify it to get what you want - but if i'm not wrong - you should convert data to bmp in order to place stuffs in the clipboard)

bye
jonny

PS: what interface/methods you use to show the bmp?

jonny
18th September 2005, 13:46
ffmpeg -y -i c1.avs -f singlejpeg -ss 00:00:00.000 -vframes 1 -an test.jpg

for avs support you can use ffmpeg inside:

http://www.nurs.or.jp/~calcium/3gpp/3GP_Converter031.zip
or
http://jonny.leffe.dnsalias.com/pspenc/rar/PSPEnc_1_00.rar

only jpg seems to work (?)