FFmpeg
view release on metacpan or search on metacpan
0.02
- added more FFmpeg::Stream attributes (height, width, channels, etc)
- FFmpeg::Stream made to be an uninstantiated base class for specific
stream types: FFmpeg::Stream::Video, ::Audio, ::Data, and ::Unknown.
- removed Inline::C dependency by reimplementing in XS (Dan Sully)
- added capture_frame() method to FFmpeg::StreamGroup. this introduces
a dependency on Image::Magick::Iterator and Image::Magick.
- changed Makefile.PL to read from $FFMPEG_ROOT environmental variable
rather than a Makefile.PL argument.
0.03 - removed FFmpeg.PMS from distro (oops, should have been gone in 0.02)
- added method for accessing header duration for RIFF files to
FFmpeg::Stream::Video FIXME not done yet.
- added input_url(), input_url_max_size(), and input_url_referrer() to
FFmpeg/StreamGroup.pm view on Meta::CPAN
# Let the code begin...
package FFmpeg::StreamGroup;
use strict;
use Data::Dumper;
use File::Copy;
use File::Temp qw(tempfile tempdir);
use IO::String;
use Image::Magick::Iterator;
use base qw();
our $VERSION = '0.01';
=head2 new()
=over
=item Usage
FFmpeg/StreamGroup.pm view on Meta::CPAN
($fh, $fn) = tempfile( UNLINK => 1, SUFFIX => '.ppm' );
$arg{ 'output_file' } = $fn;
} else {
$fn = $arg{ 'output_file' };
}
$self->transcode( %arg );
open($fh,$fn) or die "couldn't open '$fn': $!";
my $iter = Image::Magick::Iterator->new();
$iter->format( 'PPM' );
$iter->handle($fh );
return $iter;
}
=head2 transcode()
=over
# http://module-build.sourceforge.net/META-spec.html
#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
name: FFmpeg
version: 6036
version_from: FFmpeg.pm
installdirs: site
requires:
File::Temp: 0
HTTP::Request: 0
Image::Magick::Iterator: 0.01
Image::PBMlib: 1.05
LWP::UserAgent: 0
distribution_type: module
generated_by: ExtUtils::MakeMaker version 6.17
Makefile.PL view on Meta::CPAN
WriteMakefile(
'NAME' => 'FFmpeg',
'VERSION_FROM' => 'FFmpeg.pm',
'DEFINE' => '-O',
'LDDLFLAGS' => "$Config{'lddlflags'} $LDDLFLAGS",
'PREREQ_PM' => {
File::Temp => 0,
HTTP::Request => 0,
Image::Magick::Iterator => 0.01,
Image::PBMlib => 1.05, #1.06?
LWP::UserAgent => 0,
},
($] >= 5.005 ? ## Add these new keywords supported since 5.005
(ABSTRACT_FROM => 'FFmpeg.pm', # retrieve abstract from module
AUTHOR => 'Allen Day <allenday@ucla.edu>') : ()),
'PERL_MALLOC_OK' => 1,
'LIBS' => ["-L$FFMPEG_LIB -lavcodec -lavformat -lm -lz -ldl -lmp3lame -logg -lvorbis -lvorbisenc"],
t/08.capture.t view on Meta::CPAN
ok(my $sg = $ff->create_streamgroup , 'streamgroup created successfully');
ok($sg->isa('FFmpeg::StreamGroup') , 'object correct type B');
ok(my $frame = $sg->capture_frame(offset => '00:00:00'), 'captured frame');
ok(!$frame->Write(filename=>catfile('eg','test','t0.ppm')), 'wrote frame 0 to file');
ok(-f catfile('eg','test','t0.ppm') , 'frame file exists');
#CAPTURE ALL 30 frames at 1s offset, full rate
ok($iterator = $sg->capture_frames(duration => '00:00:01') , 'frame iterator');
isa_ok($iterator,'Image::Magick::Iterator' , 'frame iterator okay');
my $i = 0;
while(my $frame = $iterator->next){
$i++;
my $j = sprintf("A%03d.ppm",$i);
ok(!$frame->Write(filename=>catfile('eg','test',$j)), "wrote frame $i to file");
ok(-f catfile('eg','test',$j) , "frame file $i exists");
}
#CAPTURE ALL 30 frames at 1s offset, one frame every 0.5s
ok($iterator = $sg->capture_frames(duration => '00:00:01', video_rate => 0.5) , 'frame iterator');
isa_ok($iterator,'Image::Magick::Iterator' , 'frame iterator okay');
$i = 0;
while(my $frame = $iterator->next){
$i++;
my $j = sprintf("B%03d.ppm",$i);
ok(!$frame->Write(filename=>catfile('eg','test',$j)), "wrote frame $i to file");
ok(-f catfile('eg','test',$j) , "frame file $i exists");
#warn $i,"\t",$frame;
}
#CAPTURE ALL 30 frames at 1s offset, one frame every 0.5s, resized to 160x120
ok($iterator = $sg->capture_frames(duration => '00:00:01',
video_rate => 0.5,
video_geometry => '160x120'),
'frame iterator');
isa_ok($iterator,'Image::Magick::Iterator' , 'frame iterator okay');
$i = 0;
while(my $frame = $iterator->next){
$i++;
my $j = sprintf("C%03d.ppm",$i);
ok(!$frame->Write(filename=>catfile('eg','test',$j)), "wrote frame $i to file");
ok(-f catfile('eg','test',$j) , "frame file $i exists");
#warn $i,"\t",$frame;
}
#have to sprintf to round it -- there are extra ppm header bytes which
( run in 1.350 second using v1.01-cache-2.11-cpan-beeb90c9504 )