2017 © Pedro Peláez
 

library encoder

Laravel package for encoding video files using FFMpeg

image

vasictech/encoder

Laravel package for encoding video files using FFMpeg

  • Tuesday, October 4, 2016
  • by vasictech
  • Repository
  • 0 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Laravel Encoder (Alpha) 1.0

An OOP Laravel package user for encoding video files with FFMPEG, (*1)

Package is currently in Alpha stage, with small amount of functions, and it will be constanly upgrade with a lot different features, (*2)

This library requires a working FFMpeg install., (*3)

Installation

The recommended way to install Encoder is through Composer., (*4)

{
    "require": {
        "vasictech/encoder": "~1.0"
    }
}

Register package as service in config/app.php, (*5)

return [
    VasicTech\Encoder\EncoderServiceProvider::class,
]

Execute config publish, (*6)

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, (*7)

return [
    VasicTech\Encoder\EncoderServiceProvider::class,
]

Basic Usage

$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, (*8)

Documentation

Codec

You can provide both, or just one parameter, first is video codec, second is audio codec, (*9)

$encoder->codecs('libx264', 'libfaac');

Bitrate

You can provide both, or just one parameter, first is video bitrate, second is audio bitrate, (*10)

$encoder->bitrate('1200k', '128k');

Size

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, (*11)

$encoder->size(1280, 720);

Replace

If ffmpeg should replace already existing file, (*12)

$encoder->replace(true);

Strict

If '-strict -2' parameter should be added, (*13)

$encoder->strict(true);

Fork

If process should be forked, (*14)

$encoder->fork(true);

Log

If ffmpeg should write to log file, (*15)

$encoder->log('/path/to/file.log');

Format

Force output format, (*16)

$encoder->format('mp4');

License

This project is licensed under the MIT license., (*17)

The Versions

04/10 2016

dev-master

9999999-dev

Laravel package for encoding video files using FFMpeg

  Sources   Download

MIT

by Aleksandar Vasic

audio video encoding ffmpeg video processing audio processing