elisevgeniy / yii2-ffmpeg
convert media from one format to other
Installs: 467
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 1
Type:yii2-extension
Requires
- yiisoft/yii2: *
README
convert media from one format to other
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist elisevgeniy/yii2-ffmpeg "*"
or add
"elisevgeniy/yii2-ffmpeg": "*"
to the require section of your composer.json
file.
Configuration
Install ffmpeg in your system if not installed. To use this extension, you have to configure the Connection class in your application configuration:
return [ //.... 'components' => [ 'ffmpeg' => ['class' => '\rbtphp\ffmpeg\Ffmpeg', 'path' => '/usr/bin/ffmpeg' ], ] ];
Usage
Once the extension is installed, simply use it in your code by :
$args = array('type' => 'audio/video/image', 'input_file' => '/home/user/Pictures/movie.mp4', 'output_file' => '/home/user/Pictures/movie.mov', 'audio_bit_rate' => '20k', 'video_bit_rate' => '10k', 'thumbnail_image' => '/home/user/Pictures/movie.gif', 'thumbnail_generation' => 'yes/no', 'thumbnail_size' => '100x100' ); echo Yii::$app->ffmpeg->ffmpeg($args);```