项目作者: folour

项目描述 :
Simple API for convert audio/video files, get thumbnails from video, information of files
高级语言: PHP
项目地址: git://github.com/folour/flavy.git
创建时间: 2016-03-13T19:54:58Z
项目社区:https://github.com/folour/flavy

开源协议:GNU General Public License v3.0

下载


Flavy - a simple ffmpeg layer for laravel 5.2-5.4

Scrutinizer Code Quality
downloads
license

FFmpeg layer for Laravel 5.2-5.4, this is a fork of rafasamp/sonus package.

Simple API for convert audio/video files, get thumbnails from video, information of files

Installation

Install Flavy via composer

  1. composer require folour/flavy

In config/app.php to providers array add:

  1. Folour\Flavy\Provider\FlavyServiceProvider::class,

And to aliases array add:

  1. 'Flavy' => Folour\Flavy\FlavyFacade::class,

In terminal in project root run:

  1. php artisan vendor:publish

Usage

Simple conversion from ogg to mp3, with change bitrate:

  1. Flavy::from('path/to/file.ogg')
  2. ->to('path/to/converted/file.mp3')
  3. ->aBitrate(128)
  4. ->aCodec('libmp3lame')
  5. ->overwrite()
  6. ->run();

Decrease bitrate and change channels to 1 (Mono)

  1. Flavy::from('path/to/file.mp3')
  2. ->to('paths/to/new_file.mp3')
  3. ->aBitrate(64)
  4. ->channels(1)
  5. ->run();

Get file info:

  1. Flavy::info('path/to/file.mp3'); //returns array with file info
  2. Flavy::info('path/to/file.mp3', 'xml'); //returns xml string with file info
  3. Flavy::info('path/to/file.mp3', 'csv'); //returns csv string with file info
  4. Flavy::info('path/to/file.mp3', 'json', false); //returns json string with file info

Make thumbnails:

  1. Flavy::thumbnail('path/to/video.mov', 'path/to/images/thumb_%d.jpg', 10); //Make 10 thumbnail and calculate time interval $duration/$count
  2. Flavy::thumbnail('path/to/video.mov', 'path/to/images/thumb_%d.jpg', 10, 30); //Make 10 thumbnail with specified interval

Get ffmpeg base information:

  1. Flavy::encoders(); //return a nested array with audio and video encoders
  2. Flavy::decoders(); //return a nested array with audio and video decoders
  3. Flavy::formats(); //return array with supported formats
  4. Flavy::canEncode('encoder'); //Check encoder support
  5. Flavy::canDecode('decoder'); //Check decoder support