2017 © Pedro Peláez
 

symfony-bundle ffmpeg-converter-bundle

A bundle for Symfony2/3 that handles multimedia conversion using FFMPEG

image

vkr/ffmpeg-converter-bundle

A bundle for Symfony2/3 that handles multimedia conversion using FFMPEG

  • Sunday, May 21, 2017
  • by wladislavk
  • Repository
  • 1 Watchers
  • 0 Stars
  • 39 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

About

This is a simple bundle that handles conversion of multimedia formats using the popular FFMPEG library. It depends on VKRCustomLoggerBundle to function., (*1)

Installation

Besides enabling the bundle in AppKernel.php, you will also need to create to do some configuration., (*2)

First, add the following to parameters.yml:, (*3)

ffmpeg_path: /path/to/ffmpeg/executable

Second, you will need to add FFMPEG arguments to config.yml under vkr_ffmpeg_converter key. There can be three groups of arguments: video, audio and image. Inside each one, there should be three keys: extension corresponds to the desired destination file extension, input and output are series of arguments for FFMPEG., (*4)

In FFMPEG, unlike most other command-line tools, arguments are not idempotent, in other words, argument's behavior depends on its position in the arguments list. Input arguments are the ones that go before the source filename, output arguments go between input and output file names. For details, refer to FFMPEG manual., (*5)

Note that you do not have to specify -i argument in your config., (*6)

Finally, you need to create a log file in your app/logs folder and make it script- writable., (*7)

Usage

The usage is very simple. Just write this in your controller:, (*8)

$converter = $this->get('vkr_ffmpeg_converter.converter');
$sourceFile = new Symfony\Component\HttpFoundation\File\File('source/filename/with.path');
$destination = '/path/to/destination/dir/';
// corresponds to /app/logs/video_converter.log
$logFile = 'video_converter';
$converter->convertFile($sourceFile, $destination, $logFile);

You may also provide fourth argument to convertFile() which is maximum output file length in seconds (same as -t input argument)., (*9)

Testing

It is highly recommended that you run functional tests shipped with this bundle before writing your production code. Functional tests will help you determine if your configuration is correct as well as if this bundle will work with your version of FFMPEG., (*10)

Currently, the functional test suite provides conversions between WEBM and MP4 and between JPEG and MP4. There are no audio conversions available., (*11)

To run tests, add the following to config_test.yml file:, (*12)

imports:
    - { resource: parameters_test.yml }

Create app/config/parameters_test.yml file and add the following:, (*13)

parameters:
    vkr_ffmpeg_converter:
        video:
            extension: 'mp4'
            input: ''
            output: '-c:v libx264 -crf 20'
        image:
            extension: 'mp4'
            input: '-loop 1'
            output: '-c:v libx264 -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2"'

Run phpunit -c app/ vendor/vkr/ffmpeg-converter-bundle/Tests and see if all tests are green., (*14)

Re-run the tests after deployment to a live server., (*15)

Known limitations

  • There is only one set of settings per multimedia type. Therefore, you cannot specify different arguments for different input file types or multiple ways of conversion.
  • There can be only one input file. Therefore, you cannot do such things as gluing multiple files together.

The Versions

21/05 2017

dev-master

9999999-dev https://github.com/wladislavk/FFMPEGConverterBundle

A bundle for Symfony2/3 that handles multimedia conversion using FFMPEG

  Sources   Download

MIT

The Requires

 

The Development Requires

by Vladislav Kryshtanovskiy

symfony2 symfony3 image audio video conversion multimedia ffmpeg

21/05 2017

1.0.4

1.0.4.0 https://github.com/wladislavk/FFMPEGConverterBundle

A bundle for Symfony2/3 that handles multimedia conversion using FFMPEG

  Sources   Download

MIT

The Requires

 

The Development Requires

by Vladislav Kryshtanovskiy

symfony2 symfony3 image audio video conversion multimedia ffmpeg

19/04 2017

1.0.3

1.0.3.0 https://github.com/wladislavk/FFMPEGConverterBundle

A bundle for Symfony2/3 that handles multimedia conversion using FFMPEG

  Sources   Download

MIT

The Requires

 

The Development Requires

by Vladislav Kryshtanovskiy

symfony2 symfony3 image audio video conversion multimedia ffmpeg

23/03 2017

1.0.2

1.0.2.0 https://github.com/wladislavk/FFMPEGConverterBundle

A bundle for Symfony2/3 that handles multimedia conversion using FFMPEG

  Sources   Download

MIT

The Requires

 

The Development Requires

by Vladislav Kryshtanovskiy

symfony2 symfony3 image audio video conversion multimedia ffmpeg

14/08 2016

1.0.1

1.0.1.0 https://github.com/wladislavk/FFMPEGConverterBundle

A bundle for Symfony2/3 that handles multimedia conversion using FFMPEG

  Sources   Download

MIT

The Requires

 

The Development Requires

by Vladislav Kryshtanovskiy

symfony2 symfony3 image audio video conversion multimedia ffmpeg

08/08 2016

1.0

1.0.0.0 https://github.com/wladislavk/FFMPEGConverterBundle

A bundle for Symfony2/3 that handles multimedia conversion using FFMPEG

  Sources   Download

MIT

The Requires

 

The Development Requires

by Vladislav Kryshtanovskiy

symfony2 symfony3 image audio video conversion multimedia ffmpeg