A Wrapper Class For Ffmpeg/avconv Command Line Utility. - MetaCPAN
FFmpeg::Command - A wrapper class for ffmpeg/avconv command line utility.
DESCRIPTIONA simple interface for using ffmpeg command line utility with fallback to use the newer avconv utility if ffmpeg is not installed.
SYNOPSIS use FFmpeg::Command; my $ffmpeg = FFmpeg::Command->new('/usr/local/bin/ffmpeg'); # Set timeout $ffmpeg->timeout(300); # ga: global option a, gb: global option b # ia: infile option a, ib: infile option b # oa: outfile option a, ob: outfile option b # ffmpeg -y -ga -gb -ia -ib -i filename1 -oa -ob output_file $ffmpeg->global_options(qw/-ga -gb/); $ffmpeg->infile_options(qw/-ia -ib/); $ffmpeg->outfile_options(qw/-oa -ob/); $ffmpeg->input_file('filename1'); $ffmpeg->output_file('output_file'); my $result = $ffmpeg->exec(); croak $ffmpeg->errstr unless $result; # ffmpeg -y -i filename1 -ga -gb -ia -ib -oa -ob output_file $ffmpeg->options(qw/-ga -gb -ia -ib -oa -ob/); $ffmpeg->input_file('filename1'); $ffmpeg->output_file('output_file'); $ffmpeg->exec(); # ffmpeg -y -ga -gb -ia -ib -i filename1 -ia -ib -i filename2 -oa -ob output_file # Infile options are adopted for every input files $ffmpeg->global_options(qw/-ga -gb/); $ffmpeg->infile_options(qw/-ia -ib/); $ffmpeg->outfile_options(qw/-oa -ob/); $ffmpeg->input_file(['filename1','filename2']); $ffmpeg->output_file('output_file'); $ffmpeg->exec() # ffmpeg -y -ga -gb -ia1 -ib1 -i filename1 -ia2 -ib2 -i filename2 -oa -ob output_file # Each input file has different infile options $ffmpeg->options(qw/-ga -gb -ia1 -ib1 -i filename1 -ia2 -ib2 -i filename2 -oa -ob output_file/); $ffmpeg->exec() # This sample code takes a screen shot. $ffmpeg->input_file($input_file); $ffmpeg->output_file($output_file); $ffmpeg->options( '-f' => 'image2', '-pix_fmt' => 'jpg', '-vframes' => 1, '-ss' => 30, '-s' => '320x240', '-an', ); $ffmpeg->exec() # Below are old style example(may be obsoleted at future release) $ffmpeg->input_options({ file => $input_file, }); # Convert a video file into iPod playable format. $ffmpeg->output_options({ file => $output_file, device => 'ipod', }); # This is same as above. $ffmpeg->output_options({ file => $output_file, format => 'mp4', video_codec => 'mpeg4', bitrate => 600, frame_size => '320x240', audio_codec => 'libaac', audio_sampling_rate => 48000, audio_bit_rate => 64, }); # Convert a video file into PSP playable format. $ffmpeg->output_options({ file => $output_file, device => 'psp', }); # This is same as above. $ffmpeg->output_options({ file => $output_file, format => 'psp', video_codec => 'mpeg4', bitrate => 600, frame_size => '320x240', audio_codec => 'libaac', audio_sampling_rate => 48000, audio_bit_rate => 64, }); METHODSnew('/usr/bin/ffmpeg')
Contructs FFmpeg::Command object.It takes a path of ffmpeg command. You can omit this argument and this module searches ffmpeg command within PATH environment variable.
timeout()
Set command timeout.Default is 0.
input_file( @files );
Specify names of input file(s).
output_file('/path/to/output_file')
Specify output file name.
global_options( @options )
Specify ffmpeg global options.
infile_options( @options )
Specify ffmpeg infile options.
outfile_options( @options )
Specify ffmpeg outfile options.
options( @options )
Specify ffmpeg command options directly including input files and and output file.
execute()
Executes ffmpeg command with specified options.
exec()
An alias of execute()
stdout()
Get ffmpeg command output to stdout.
stderr()
Get ffmpeg command output to stderr.
input_options({ %options })
Specify input file name and input options.(Now no options are available.)
filea file name of input file or an anonymous list of multiple input files (useful for merging audio and video files together).
output_options({ %options })
Specify output file name and output options.
Avaiable options are:
filea file name of output file.
formatOutput video format.
video_codecOutput video codec.
bitrateOutput video bitrate.
frame_sizeOutput video screen size.
audio_codecOutput audio code.
audio_sampling_rateOutput audio sampling rate.
audio_bit_rateOutput audio bit rate.
titleSet the title.
authorSet the author.
commentSet the comment.
AUTHORSGosuke Miyashita, <gosukenator at gmail.com>
Munechika Sumikawa, <sumikawa at sumikawa.jp>
BUGSPlease report any bugs or feature requests to bug-ffmpeg-command at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=FFmpeg-Command. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORTYou can find documentation for this module with the perldoc command.
perldoc FFmpeg::CommandYou can also look for information at:
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/FFmpeg-Command
CPAN Ratings
http://cpanratings.perl.org/d/FFmpeg-Command
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=FFmpeg-Command
Search CPAN
http://search.cpan.org/dist/FFmpeg-Command
Copyright 2006 Gosuke Miyashita, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Từ khóa » Ffmpeg Lệnh
-
FFmpeg Và 20 Câu Lệnh Cơ Bản Xử Lý âm Thanh, Hình ảnh Và Video
-
Sử Dụng FFMPEG Với Những Câu Lệnh đơn Giản - Viblo
-
Tổng Hợp 20 Lệnh FFmpeg Cơ Bản Cho Người Mới Bắt đầu - Freetuts
-
Ffmpeg Documentation
-
[FFmpeg Tutorial] Những Câu Lệnh FFmpeg Xử Lý Video
-
Hướng Dẫn Sử Dụng FFMPEG Tools Và Các Câu Lệnh Xử Lý Video ...
-
Nodejs Aws Lambda Ffmpeg Command Failure - Stack Overflow
-
Tìm Hiểu Các Câu Lệnh Encode Audio/video Với FFMPEG - Kipalog
-
How To Merge Videos Together Use VLC Command Line(some Video ...
-
How To Keep Audio Silence With Ffmpeg Command - Super User
-
FFmpeg Command Options - 2020 - BogoToBogo
-
Một Số Lệnh FFmpeg Thường Dùng - Anh Duc
-
Các Lệnh FFMPEG Hữu ích để Quản Lý Các Tệp âm Thanh Và Video
-
Ffmpeg Commands. - Gists · GitHub