FFmpeg-Stream-Helper
view release on metacpan or search on metacpan
lib/FFmpeg/Stream/Helper.pm view on Meta::CPAN
package FFmpeg::Stream::Helper;
use 5.006;
use strict;
use warnings;
use base 'Error::Helper';
use String::ShellQuote;
=head1 NAME
FFmpeg::Stream::Helper - Helper for streaming and transcoding using ffmpeg.
=head1 VERSION
Version 0.1.1
=cut
our $VERSION = '0.1.1';
=head1 SYNOPSIS
This module is for helping generate a command for ffmpeg that should be good for streaming to HTML5.
This module also does it securely by using String::ShellQuote for every definable option passed to ffmpeg.
# Defaults Are...
# Output: - ((standard out))
# Bit Rate: 2000 kbps
# Bound: undef
# Format: mp4
# Log Level: quiet
# Threads: 0
my $fsh=FFmpeg::Stream::Helper->new;
#sets the bit rate to 1500
$fsh->bitRateSet('1500');
if ( $fsh->error ){
warn('error:'.$fsh->error.': '.$fsh->errorString);
}
# Enable printing of errors.
$fsh->loglevelSet('error');
if ( $fsh->error ){
warn('error:'.$fsh->error.': '.$fsh->errorString);
}
# set the width bound to 800 for scaling
# aspect will be kept
$fsh->boundSet('800');
if ( $fsh->error ){
warn('error:'.$fsh->error.': '.$fsh->errorString);
}
# Disable pretty much all error output. This is great if you are sending stuff
# to STDOUT and what you are sending it to can't tell the difference between it
# and STDERR
$fsh->loglevelSet('quiet');
if ( $fsh->error ){
warn('error:'.$fsh->error.': '.$fsh->errorString);
}
# What? No. We can't stop here. This is bat country.
my $command=$fsh->command('/arc/video/movies/Fear and Loathing in Las Vegas.avi');
if ( $fsh->error ){
warn('error:'.$fsh->error.': '.$fsh->errorString);
}
=head1 METHODS
=head2 new
Inits a new object for use.
No need for error checking. This will always succeed.
my $fsh=FFmpeg::Stream::Helper->new;
=cut
sub new{
my $self={
error=>undef,
( run in 1.076 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )