Download the PHP package rafasamp/sonus without Composer

On this page you can find all versions of the php package rafasamp/sonus. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package sonus

Project Status

I regret to inform that I will not be updating Sonus any further. Unfortunately life has got in the way and I cannot dedicate the time for this project. There is a fork by closca here that supports Laravel 5. I will keep the Github page alive in case anyone needs to reference it.

Thank you to everyone who used this little project of mine!

Sonus (Laravel 4 Package)

Latest Stable Version Build Status Total Downloads ProjectStatus License

Sonus is a tool designed to leverage the power of Laravel 4 and ffmpeg to perform tasks such as:

Quick Start

Setup

Update your composer.json file and add the following under the require key

"rafasamp/sonus": "dev-master"

Run the composer update command:

$ composer update

In your config/app.php add 'Rafasamp\Sonus\SonusServiceProvider' to the end of the $providers array

'providers' => array(

    'Illuminate\Foundation\Providers\ArtisanServiceProvider',
    'Illuminate\Auth\AuthServiceProvider',
    ...
    'Rafasamp\Sonus\SonusServiceProvider',

),

Still under config/app.php add 'Sonus' => 'Rafasamp\Sonus\Facade' to the $aliases array

'aliases' => array(

    'App'             => 'Illuminate\Support\Facades\App',
    'Artisan'         => 'Illuminate\Support\Facades\Artisan',
    ...
    'Sonus'           => 'Rafasamp\Sonus\Facade',

),

Run the artisan command below to publish the configuration file

$ php artisan config:publish rafasamp/sonus

Navigate to app/config/packages/Rafasamp/Sonus/config.php and update all four parameters

Examples

Here is a simple example of a file being converted from FLAC to AAC:

Sonus::convert()->input('foo.flac')->bitrate(128)->output('bar.aac')->go();

Sonus can also convert video files:

Sonus::convert()->input('foo.avi')->bitrate(300, 'video')->output('bar.flv')->go();

Sonus can also return media information as an array or json

Sonus::getMediaInfo('foo.mov');

Sonus can also easily generate smart movie thumbnails like this

Sonus::getThumbnails('foo.mp4', 'foo-thumb' 5); // Yields 5 thumbnails

Although Sonus contains several preset parameters, you can also pass your own

Sonus::convert()->input('foo.flac')->output('bar.mp3')->go('-b:a 64k -ac 1');

Tracking progress

Make sure the progress and tmp_dir options are set correctly in the config.php file

'progress'      => true,
...
'tmp_dir'      => '/Applications/ffmpeg/tmp/'

Pass the progress method when initiating a conversion

Sonus::convert()->input('foo.avi')->output('bar.mp3')->progress('uniqueid')->go();

Now you can write a controller action to return the progress for the job id you passed and call it using any flavor of JavaScript you like

public function getJobProgress($id)
{
    return Sonus::getProgress('uniqueid');
}

Security and Compatibility

Sonus uses PHP's shell_exec function to perform ffmpeg and ffprobe commands. This command is disabled if you are running PHP 5.3 or below and safe mode is enabled.

Please make sure that ffmpeg and ffprobe are at least the following versions:

Also, remember that filepaths must be relative to the location of FFMPEG on your system. To ensure compatibility, it is good practice to pass the full path of the input and output files. Here's an example working in Laravel:

$file_in  = Input::file('audio')->getRealPath();
$file_out = '\path\to\my\file.mp3'; 
Sonus::convert()->input($file_in)->output($file_out)->go();

Lastly, Sonus will only convert to formats which ffmpeg supports. To check if your version of ffmpeg is configured to encode or decode a specific format you can run the following commands using php artisan tinker

var_dump(Sonus::canEncode('mp3'));
var_dump(Sonus::canDecode('mp3'));

To get a list of all supported formats you can run

var_dump(Sonus::getSupportedFormats());

Troubleshooting

Please make sure the following statements are true before opening an issue:

1) I am able to access FFMPEG on terminal using the same path I defined in the Sonus configuration file

2) I have checked the error logs for the webserver and found no FFMPEG output messages

Usually all concerns are taken care of by following these two steps. If you still find yourself having issues you can always open a trouble ticket.

Planned features

License

Sonus is free software distributed under the terms of the MIT license.

Aditional information

Any questions, feel free to contact me.

Any issues, please report here


All versions of sonus with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
illuminate/support Version 4.2.*
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package rafasamp/sonus contains the following files

Loading the files please wait ....