1#!/usr/bin/perl 2use strict; 3 4#use lib("/home/peter/ming3/lib/perl5/site_perl"); 5 6$|=1; 7use SWF qw(:ALL); 8 9my $file = '../common/test.flv'; 10 11 12 13my $stream=new SWF::VideoStream($file); 14$stream->setDimension(200,200); 15 16my $m=new SWF::Movie(); 17$m->setDimension(400, 300); 18$m->setRate(12.0); 19$m->add($stream); 20for(1..$stream->getNumFrames()) { 21 $m->nextFrame(); 22} 23 24# decide if its called from commandline or as cgiscript 25if (exists $ENV{"REQUEST_URI"}){ 26 print "Content-type: application/x-shockwave-flash\n\n"; 27 $m->output(); 28} 29else { 30 $m->save("$0.swf"); 31 print "Generated file written to $0.swf\n"; 32} 33