Package Data | |
---|---|
Maintainer Username: | ivebe |
Maintainer Contact: | dan@quantox.com (Dan) |
Package Create Date: | 2017-01-11 |
Package Last Update: | 2017-06-02 |
Language: | PHP |
License: | Unknown |
Last Refreshed: | 2025-02-08 15:04:39 |
Package Statistics | |
---|---|
Total Downloads: | 75 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 5 |
Total Watchers: | 5 |
Total Forks: | 5 |
Total Open Issues: | 1 |
PHP-FFMpeg implementation in Laravel with progress bar. Plug and play.
Install using composer.
composer require ivebe/lffmpeg
After you install it add service provider to the providers array in the config/app.php
Ivebe\Lffmpeg\LffmpegServiceProvider::class
Publishing at least config from the vendor is required, this is tagged as defaults. Available tags are migrations
, models
, assets
, views
and defaults
. If you are building from scratch you can just ommit tag completely and publish everything. However if you already have system in place, and want to adopt it to use Lffmpeg, then publish defaults (config) only, and add current models implementation in the config file.
php artisan vendor:publish --tag=defaults
This is where encoding settings are placed, and also models that will handle the logic. Lffmpeg already have 3 eloquent models for Video, Thumb, and EncodingProgress
Paths should not end with slash.
Location of the ffmpeg binaries.
Desired profile used for encoding. Lffmpeg will automatically detect best possibile quality and encode from it. In other words if you have video that is not HD, then 1080p profile wont be encoded, it will start from the best match profile. There is no upscalling.
/**
* w - width
* h - height
* b - bitrate
*/
'encoding' => [
'1080p' => [
'w' => 1920,
'h' => 1080,
'b' => 2000
],
'720p' => [
'w' => 1280,
'h' => 720,
'b' => 1500
],
'480p' => [
'w' => 854,
'h' => 480,
'b' => 1000
]
]
Videos are manipulated using VideoRepository. By default there is only Eloquent repository, so you need to set video model in the config file. If you are already having your video model, then just point proper column names and your model will be used instead. Note that variables are marked with #
while colum names are marked with @
.
Thumbs are manipulated using ThumbRepository. By default there is only Eloquent repository, so you need to set thumb model in the config file. If you are already having your thumb model, then just point proper column names and your model will be used instead. Note that variables are marked with #
while colum names are marked with @
.
EncodingProgress doesn't have it's own repository, it is manipulated using VideoRepository. By default there is only Eloquent repository, so you need to set EncodingProgress model in the config file. If you are already having your EncodingProgress model, then just point proper column names and your model will be used instead. Note that variables are marked with #
while colum names are marked with @
.
Basic usage is as simple as typing Helper::runEncoding(123);
where 123 is video ID in the Video repository. However you should know that each encoding process is done using jobs and queues, so you should setup your queue properly.
Available tags are migrations
, models
, assets
, views
and defaults
.
php artisan migrate
php artisan vendor:publish --tag=models
will place Video, Thumb and EncodingProgress models in the app directory.public/assets/lffmpeg.js
which will have simple js written to handle display of the progress bar. You can see sample of it's usage if you publish views also.resources/views/lffmpeg.blade.php