PHPackages                             javer/ffmpeg-transformer - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. javer/ffmpeg-transformer

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

javer/ffmpeg-transformer
========================

FFmpeg transformation command builder

v1.3.1(4y ago)846.5k↓41.9%1MITPHPPHP &gt;=8.0

Since Jun 18Pushed 4y ago1 watchersCompare

[ Source](https://github.com/javer/ffmpeg-transformer)[ Packagist](https://packagist.org/packages/javer/ffmpeg-transformer)[ Docs](https://github.com/javer/ffmpeg-transformer)[ RSS](/packages/javer-ffmpeg-transformer/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (5)Versions (9)Used By (0)

FFmpeg transformer
==================

[](#ffmpeg-transformer)

This library simplifies usage of [FFmpeg](https://www.ffmpeg.org) for complex transcoding of the media files in PHP applications.

Features:

- FFmpeg command builder
- Media profile builder
- Profile transformer
- Command transformer

Requirements
------------

[](#requirements)

- PHP 8.0+
- [php-ffmpeg/php-ffmpeg](https://packagist.org/packages/php-ffmpeg/php-ffmpeg) for extracting media profile directly from the media file.

Installation
------------

[](#installation)

Install the library using composer:

```
composer require javer/ffmpeg-transformer
```

FFmpeg command builder
----------------------

[](#ffmpeg-command-builder)

Enables you to build FFmpeg command line in OOP style.

For example, for retranscoding of the source media file in any format/codecs to mp4/h264/aac you need just write:

```
$command = (new Command())
    ->overwriteOutputFiles();

$inputFile = $command->addInput('input.mov');

$command->addOutput('output.mp4')
    ->moveHeaderToStart()
    ->addVideoStream($inputFile->getVideoStream())
        ->codec('libx264')
        ->preset('veryfast')
        ->pixelFormat('yuv420p')
    ->end()
    ->addAudioStream($inputFile->getAudioStream())
        ->codec('aac')
    ->end();
```

To build command line which performs this transformation just call `$command->build()` which will return array of all command line arguments to achieve the goal:

```
[
    '-y',
    '-i', 'input.mov',
    '-movflags', 'faststart',
    '-map', '0:v:0', '-c:v:0', 'libx264', '-preset', 'veryfast', '-pix_fmt:v:0', 'yuv420p',
    '-map', '0:a:0', '-c:a:0', 'aac',
    'output.mp4',
]

```

More examples can be found in [CommandTest](http://github.com/javer/ffmpeg-transformer/blob/master/tests/Command/CommandTest.php).

Media profile builder
---------------------

[](#media-profile-builder)

Enables you to create `MediaProfile` for the given media file or from the given array.

From file:

```
$ffmpeg = new FFMpeg\FFMpeg(...);
$inputVideo = $ffmpeg->open($filename);
$inputMediaProfile = MediaProfile::fromMedia($inputVideo);
```

From array:

```
$referenceMediaProfile = MediaProfile::fromArray([
    'name' => 'reference',
    'format' => 'mp4',
    'video' => [
        'width' => 1920,
        'height' => 1080,
        'codec' => 'h264',
        'profile' => 'main',
        'preset' => 'veryfast',
        'pixel_format' => 'yuv420p',
        'bitrate' => '6000k',
        'frame_rate' => 29.97,
        'keyframe_interval' => 250,
    ],
    'audio' => [
        'codec' => 'aac',
        'bitrate' => '128k',
        'sample_rate' => '48k',
    ],
]);
```

Profile transformer
-------------------

[](#profile-transformer)

Performs calculation of the transformation which should be applied to the input MediaProfile to get output MediaProfile (usually reference).

```
$transformation = (new ProfileTransformer())
    ->transformMedia($sourceMediaProfile, $referenceMediaProfile);
```

It returns a new `MediaProfile` which contains only necessary parameters which should be changed.

Command transformer
-------------------

[](#command-transformer)

Builds a command for FFmpeg to perform necessary transformation (from the previous step) to transform input media file to the output media file.

```
$command = (new CommandTransformer())
    ->applyTransformation($transformation, $inputFilename, $outputFilename);
```

It returns a `Command` (see the first section) which should be run by ffmpeg to convert input media file to the reference.

```
$ffmpeg->getFFMpegDriver()->command($command->build());
```

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~179 days

Recently: every ~143 days

Total

7

Last Release

1819d ago

PHP version history (3 changes)v1.0.0PHP ^7.1

v1.2.0PHP &gt;=7.1

v1.3.0PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/7e4ae642c5f1ad16c9b07e976096123f9ef8d50ee7df05123ed1e7f55b29caa9?d=identicon)[javer](/maintainers/javer)

---

Top Contributors

[![javer](https://avatars.githubusercontent.com/u/591296?v=4)](https://github.com/javer "javer (14 commits)")

---

Tags

ffmpegbuilderadaptercommandtransformer

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/javer-ffmpeg-transformer/health.svg)

```
[![Health](https://phpackages.com/badges/javer-ffmpeg-transformer/health.svg)](https://phpackages.com/packages/javer-ffmpeg-transformer)
```

###  Alternatives

[kris/laravel-form-builder

Laravel form builder - symfony like

1.7k2.2M45](/packages/kris-laravel-form-builder)[aimeos/aimeos-base

Aimeos base layer for abstracting from host environments

2.1k134.0k1](/packages/aimeos-aimeos-base)[gherkins/regexpbuilderphp

PHP port of thebinarysearchtree/regexpbuilderjs

1.4k163.0k1](/packages/gherkins-regexpbuilderphp)[php-ffmpeg/extras

A set of audio/video formats compatible with PHP-FFMpeg

182287.6k1](/packages/php-ffmpeg-extras)[optimistdigital/nova-menu-builder

This Laravel Nova package allows you to create and manage menus and menu items.

243369.4k](/packages/optimistdigital-nova-menu-builder)[outl1ne/nova-menu-builder

This Laravel Nova package allows you to create and manage menus and menu items.

243246.0k3](/packages/outl1ne-nova-menu-builder)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
