Package Data | |
---|---|
Maintainer Username: | vasictech |
Maintainer Contact: | info@vasictech.com (Aleksandar Vasic) |
Package Create Date: | 2016-10-04 |
Package Last Update: | 2016-10-04 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-12-24 03:03:18 |
Package Statistics | |
---|---|
Total Downloads: | 16 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 0 |
Total Watchers: | 0 |
Total Forks: | 0 |
Total Open Issues: | 0 |
#Laravel Encoder (Alpha) 1.0
An OOP Laravel package user for encoding video files with FFMPEG
Package is currently in Alpha stage, with small amount of functions, and it will be constanly upgrade with a lot different features
This library requires a working FFMpeg install.
The recommended way to install Encoder is through Composer.
{
"require": {
"vasictech/encoder": "~1.0"
}
}
Register package as service in config/app.php
return [
VasicTech\Encoder\EncoderServiceProvider::class,
]
Execute config publish
return [
'encoder' => 'ffmpeg',
'ffmpeg' => [
'path' => '/usr/bin/ffmpeg',
'codecs' => [
'video' => 'libx264',
'audio' => 'aac',
],
'options' => [
'strict' => true,
'replace' => true,
'fork' => true,
'log' => storage_path(),
]
]
];
Configure config file
return [
VasicTech\Encoder\EncoderServiceProvider::class,
]
$encoder = VasicTech\Encoder\Encoder\FFMpeg();
$jobId = $encoder
->input(storage_path('app/public/trailer.mp4'))
->output(storage_path('app/public/trailer_enc.mp4'))
->execute();
Script returns jobID which can be recorded in database to be connected with files. Output log file will be named as jobID
You can provide both, or just one parameter, first is video codec, second is audio codec
$encoder->codecs('libx264', 'libfaac');
You can provide both, or just one parameter, first is video bitrate, second is audio bitrate
$encoder->bitrate('1200k', '128k');
You can provide both, or just one parameter, first is video width, second is video height, if one is not provided, video will scale to provided size
$encoder->size(1280, 720);
If ffmpeg should replace already existing file
$encoder->replace(true);
If '-strict -2' parameter should be added
$encoder->strict(true);
If process should be forked
$encoder->fork(true);
If ffmpeg should write to log file
$encoder->log('/path/to/file.log');
Force output format
$encoder->format('mp4');
This project is licensed under the MIT license.