Giter VIP home page Giter VIP logo

php-ffmpeg's Introduction

PHP-FFMPEG

Latest Version on Packagist Software License run-tests Total Downloads

An Object-Oriented library to convert video/audio files with FFmpeg / AVConv.

Your attention please

How this library works:

This library requires a working FFMpeg install. You will need both FFMpeg and FFProbe binaries to use it. Be sure that these binaries can be located with system PATH to get the benefit of the binary detection, otherwise you should have to explicitly give the binaries path on load.

Known issues:

  • Using rotate and resize will produce a corrupted output when using libav 0.8. The bug is fixed in version 9. This bug does not appear in latest ffmpeg version.

Installation

This library requires PHP 8.0 or higher. For older versions of PHP, check out the 0.x-branch.

The recommended way to install PHP-FFMpeg is through Composer.

$ composer require php-ffmpeg/php-ffmpeg

Basic Usage

require 'vendor/autoload.php';

$ffmpeg = FFMpeg\FFMpeg::create();
$video = $ffmpeg->open('video.mpg');
$video
    ->filters()
    ->resize(new FFMpeg\Coordinate\Dimension(320, 240))
    ->synchronize();
$video
    ->frame(FFMpeg\Coordinate\TimeCode::fromSeconds(10))
    ->save('frame.jpg');
$video
    ->save(new FFMpeg\Format\Video\X264(), 'export-x264.mp4')
    ->save(new FFMpeg\Format\Video\WMV(), 'export-wmv.wmv')
    ->save(new FFMpeg\Format\Video\WebM(), 'export-webm.webm');

Documentation

This documentation is an introduction to discover the API. It's recommended to browse the source code as it is self-documented.

FFMpeg

FFMpeg\FFMpeg is the main object to use to manipulate medias. To build it, use the static FFMpeg\FFMpeg::create:

$ffmpeg = FFMpeg\FFMpeg::create();

FFMpeg will autodetect ffmpeg and ffprobe binaries. If you want to give binary paths explicitly, you can pass an array as configuration. A Psr\Logger\LoggerInterface can also be passed to log binary executions.

$ffmpeg = FFMpeg\FFMpeg::create(array(
    'ffmpeg.binaries'  => '/opt/local/ffmpeg/bin/ffmpeg',
    'ffprobe.binaries' => '/opt/local/ffmpeg/bin/ffprobe',
    'timeout'          => 3600, // The timeout for the underlying process
    'ffmpeg.threads'   => 12,   // The number of threads that FFMpeg should use
), $logger);

You may pass a temporary_directory key to specify a path for temporary files.

$ffmpeg = FFMpeg\FFMpeg::create(array(
    'temporary_directory' => '/var/ffmpeg-tmp'
), $logger);

Manipulate media

FFMpeg\FFMpeg creates media based on URIs. URIs could be either a pointer to a local filesystem resource, an HTTP resource or any resource supported by FFmpeg.

Note: To list all supported resource type of your FFmpeg build, use the -protocols command:

ffmpeg -protocols

To open a resource, use the FFMpeg\FFMpeg::open method.

$ffmpeg->open('video.mpeg');

Two types of media can be resolved: FFMpeg\Media\Audio and FFMpeg\Media\Video. A third type, FFMpeg\Media\Frame, is available through videos.

Video

FFMpeg\Media\Video can be transcoded, ie: change codec, isolate audio or video. Frames can be extracted.

Transcoding

You can transcode videos using the FFMpeg\Media\Video:save method. You will pass a FFMpeg\Format\FormatInterface for that.

Please note that audio and video bitrate are set on the format. You can disable the -b:v option by setting the kilo bitrate to 0.

$format = new FFMpeg\Format\Video\X264();
$format->on('progress', function ($video, $format, $percentage) {
    echo "$percentage % transcoded";
});

$format
    ->setKiloBitrate(1000)
    ->setAudioChannels(2)
    ->setAudioKiloBitrate(256);

$video->save($format, 'video.avi');

Transcoding progress can be monitored in realtime, see Format documentation below for more information.

Extracting image

You can extract a frame at any timecode using the FFMpeg\Media\Video::frame method.

This code returns a FFMpeg\Media\Frame instance corresponding to the second 42. You can pass any FFMpeg\Coordinate\TimeCode as argument, see dedicated documentation below for more information.

$frame = $video->frame(FFMpeg\Coordinate\TimeCode::fromSeconds(42));
$frame->save('image.jpg');

If you want to extract multiple images from the video, you can use the following filter:

$video
    ->filters()
    ->extractMultipleFrames(FFMpeg\Filters\Video\ExtractMultipleFramesFilter::FRAMERATE_EVERY_10SEC, '/path/to/destination/folder/')
    ->synchronize();

$video
    ->save(new FFMpeg\Format\Video\X264(), '/path/to/new/file');

By default, this will save the frames as jpg images.

You are able to override this using setFrameFileType to save the frames in another format:

$frameFileType = 'jpg'; // either 'jpg', 'jpeg' or 'png'
$filter = new ExtractMultipleFramesFilter($frameRate, $destinationFolder);
$filter->setFrameFileType($frameFileType);

$video->addFilter($filter);
Clip

Cuts the video at a desired point. Use input seeking method. It is faster option than use filter clip.

$clip = $video->clip(FFMpeg\Coordinate\TimeCode::fromSeconds(30), FFMpeg\Coordinate\TimeCode::fromSeconds(15));
$clip->save(new FFMpeg\Format\Video\X264(), 'video.avi');

The clip filter takes two parameters:

  • $start, an instance of FFMpeg\Coordinate\TimeCode, specifies the start point of the clip
  • $duration, optional, an instance of FFMpeg\Coordinate\TimeCode, specifies the duration of the clip

On clip you can apply same filters as on video. For example resizing filter.

$clip = $video->clip(FFMpeg\Coordinate\TimeCode::fromSeconds(30), FFMpeg\Coordinate\TimeCode::fromSeconds(15));
$clip->filters()->resize(new FFMpeg\Coordinate\Dimension(320, 240), FFMpeg\Filters\Video\ResizeFilter::RESIZEMODE_INSET, true);
$clip->save(new FFMpeg\Format\Video\X264(), 'video.avi');
Generate a waveform

You can generate a waveform of an audio file using the FFMpeg\Media\Audio::waveform method.

This code returns a FFMpeg\Media\Waveform instance. You can optionally pass dimensions as the first two arguments and an array of hex string colors for ffmpeg to use for the waveform, see dedicated documentation below for more information.

The output file MUST use the PNG extension.

$waveform = $audio->waveform(640, 120, array('#00FF00'));
$waveform->save('waveform.png');

If you want to get a waveform from a video, convert it in an audio file first.

// Open your video file
$video = $ffmpeg->open( 'video.mp4' );

// Set an audio format
$audio_format = new FFMpeg\Format\Audio\Mp3();

// Extract the audio into a new file as mp3
$video->save($audio_format, 'audio.mp3');

// Set the audio file
$audio = $ffmpeg->open( 'audio.mp3' );

// Create the waveform
$waveform = $audio->waveform();
$waveform->save( 'waveform.png' );
Filters

You can apply filters on FFMpeg\Media\Video with the FFMpeg\Media\Video::addFilter method. Video accepts Audio and Video filters.

You can build your own filters and some are bundled in PHP-FFMpeg - they are accessible through the FFMpeg\Media\Video::filters method.

Filters are chainable

$video
    ->filters()
    ->resize($dimension, $mode, $useStandards)
    ->framerate($framerate, $gop)
    ->synchronize();
Rotate

Rotates a video to a given angle.

$video->filters()->rotate($angle);

The $angle parameter must be one of the following constants :

  • FFMpeg\Filters\Video\RotateFilter::ROTATE_90: 90° clockwise
  • FFMpeg\Filters\Video\RotateFilter::ROTATE_180: 180°
  • FFMpeg\Filters\Video\RotateFilter::ROTATE_270: 90° counterclockwise
Resize

Resizes a video to a given size.

$video->filters()->resize($dimension, $mode, $useStandards);

The resize filter takes three parameters:

  • $dimension, an instance of FFMpeg\Coordinate\Dimension
  • $mode, one of the constants FFMpeg\Filters\Video\ResizeFilter::RESIZEMODE_* constants
  • $useStandards, a boolean to force the use of the nearest aspect ratio standard.

If you want a video in a non-standard ratio, you can use the padding filter to resize your video in the desired size, and wrap it into black bars.

$video->filters()->pad($dimension);

The pad filter takes one parameter:

  • $dimension, an instance of FFMpeg\Coordinate\Dimension

Don't forget to save it afterwards.

$video->save(new FFMpeg\Format\Video\X264(), $new_file);
Watermark

Watermark a video with a given image.

$video
    ->filters()
    ->watermark($watermarkPath, array(
        'position' => 'relative',
        'bottom' => 50,
        'right' => 50,
    ));

The watermark filter takes two parameters:

$watermarkPath, the path to your watermark file. $coordinates, an array defining how you want your watermark positioned. You can use relative positioning as demonstrated above or absolute as such:

$video
    ->filters()
    ->watermark($watermarkPath, array(
        'position' => 'absolute',
        'x' => 1180,
        'y' => 620,
    ));
Framerate

Changes the frame rate of the video.

$video->filters()->framerate($framerate, $gop);

The framerate filter takes two parameters:

  • $framerate, an instance of FFMpeg\Coordinate\FrameRate
  • $gop, a GOP value (integer)
Synchronize

Synchronizes audio and video.

Some containers may use a delay that results in desynchronized outputs. This filter solves this issue.

$video->filters()->synchronize();
Clip

Cuts the video at a desired point.

$video->filters()->clip(FFMpeg\Coordinate\TimeCode::fromSeconds(30), FFMpeg\Coordinate\TimeCode::fromSeconds(15));

The clip filter takes two parameters:

  • $start, an instance of FFMpeg\Coordinate\TimeCode, specifies the start point of the clip
  • $duration, optional, an instance of FFMpeg\Coordinate\TimeCode, specifies the duration of the clip
Crop

Crops the video based on a width and height(a Point)

$video->filters()->crop(new FFMpeg\Coordinate\Point("t*100", 0, true), new FFMpeg\Coordinate\Dimension(200, 600));

It takes two parameters:

  • $point, an instance of FFMpeg\Coordinate\Point, specifies the point to crop
  • $dimension, an instance of FFMpeg\Coordinate\Dimension, specifies the dimension of the output video

Audio

FFMpeg\Media\Audio can be transcoded too, ie: change codec, isolate audio or video. Frames can be extracted.

Transcoding

You can transcode audios using the FFMpeg\Media\Audio:save method. You will pass a FFMpeg\Format\FormatInterface for that.

Please note that audio kilobitrate is set on the audio format.

$ffmpeg = FFMpeg\FFMpeg::create();
$audio = $ffmpeg->open('track.mp3');

$format = new FFMpeg\Format\Audio\Flac();
$format->on('progress', function ($audio, $format, $percentage) {
    echo "$percentage % transcoded";
});

$format
    ->setAudioChannels(2)
    ->setAudioKiloBitrate(256);

$audio->save($format, 'track.flac');

Transcoding progress can be monitored in realtime, see Format documentation below for more information.

Filters

You can apply filters on FFMpeg\Media\Audio with the FFMpeg\Media\Audio::addFilter method. It only accepts audio filters.

You can build your own filters and some are bundled in PHP-FFMpeg - they are accessible through the FFMpeg\Media\Audio::filters method.

Clipping

Cuts the audio at a desired point.

$audio->filters()->clip(FFMpeg\Coordinate\TimeCode::fromSeconds(30), FFMpeg\Coordinate\TimeCode::fromSeconds(15));
Metadata

Add metadata to audio files. Just pass an array of key=value pairs of all metadata you would like to add. If no arguments are passed into the filter all metadata will be removed from input file. Currently supported data is title, artist, album, artist, composer, track, year, description, artwork

$audio->filters()->addMetadata(["title" => "Some Title", "track" => 1]);

//remove all metadata and video streams from audio file
$audio->filters()->addMetadata();

Add artwork to the audio file

$audio->filters()->addMetadata(["artwork" => "/path/to/image/file.jpg"]);

NOTE: at present ffmpeg (version 3.2.2) only supports artwork output for .mp3 files

Resample

Resamples an audio file.

$audio->filters()->resample($rate);

The resample filter takes two parameters :

  • $rate, a valid audio sample rate value (integer)

Frame

A frame is an image at a timecode of a video; see documentation above about frame extraction.

You can save frames using the FFMpeg\Media\Frame::save method.

$frame->save('target.jpg');

This method has a second optional boolean parameter. Set it to true to get accurate images; it takes more time to execute.

Gif

A gif is an animated image extracted from a sequence of the video.

You can save gif files using the FFMpeg\Media\Gif::save method.

$video = $ffmpeg->open( '/path/to/video' );
$video
    ->gif(FFMpeg\Coordinate\TimeCode::fromSeconds(2), new FFMpeg\Coordinate\Dimension(640, 480), 3)
    ->save($new_file);

This method has a third optional boolean parameter, which is the duration of the animation. If you don't set it, you will get a fixed gif image.

Concatenation

This feature allows you to generate one audio or video file, based on multiple sources.

There are two ways to concatenate videos, depending on the codecs of the sources. If your sources have all been encoded with the same codec, you will want to use the FFMpeg\Media\Concatenate::saveFromSameCodecs which has way better performances. If your sources have been encoded with different codecs, you will want to use the FFMpeg\Media\Concatenate::saveFromDifferentCodecs.

The first function will use the initial codec as the one for the generated file. With the second function, you will be able to choose which codec you want for the generated file.

You also need to pay attention to the fact that, when using the saveFromDifferentCodecs method, your files MUST have video and audio streams.

In both cases, you will have to provide an array of files.

To concatenate videos encoded with the same codec, do as follow:

// In order to instantiate the video object, you HAVE TO pass a path to a valid video file.
// We recommend that you put there the path of any of the video you want to use in this concatenation.
$video = $ffmpeg->open( '/path/to/video' );
$video
    ->concat(array('/path/to/video1', '/path/to/video2'))
    ->saveFromSameCodecs('/path/to/new_file', TRUE);

The boolean parameter of the save function allows you to use the copy parameter which accelerates drastically the generation of the encoded file.

To concatenate videos encoded with the different codec, do as follow:

// In order to instantiate the video object, you HAVE TO pass a path to a valid video file.
// We recommend that you put there the path of any of the video you want to use in this concatenation.
$video = $ffmpeg->open( '/path/to/video' );

$format = new FFMpeg\Format\Video\X264();
$format->setAudioCodec("libmp3lame");

$video
    ->concat(array('/path/to/video1', '/path/to/video2'))
    ->saveFromDifferentCodecs($format, '/path/to/new_file');

More details about concatenation in FFMPEG can be found here, here and here.

AdvancedMedia

AdvancedMedia may have multiple inputs and multiple outputs.

This class has been developed primarily to use with -filter_complex.

So, its filters() method accepts only filters that can be used inside -filter_complex command. AdvancedMedia already contains some built-in filters.

Base usage

For example:

$advancedMedia = $ffmpeg->openAdvanced(array('video_1.mp4', 'video_2.mp4'));
$advancedMedia->filters()
    ->custom('[0:v][1:v]', 'hstack', '[v]');
$advancedMedia
    ->map(array('0:a', '[v]'), new X264('aac', 'libx264'), 'output.mp4')
    ->save();

This code takes 2 input videos, stacks they horizontally in 1 output video and adds to this new video the audio from the first video. (It is impossible with simple filtergraph that has only 1 input and only 1 output).

Complicated example

A more difficult example of possibilities of the AdvancedMedia. Consider all input videos already have the same resolution and duration. ("xstack" filter has been added in the 4.1 version of the ffmpeg).

$inputs = array(
    'video_1.mp4',
    'video_2.mp4',
    'video_3.mp4',
    'video_4.mp4',
);

$advancedMedia = $ffmpeg->openAdvanced($inputs);
$advancedMedia->filters()
    ->custom('[0:v]', 'negate', '[v0negate]')
    ->custom('[1:v]', 'edgedetect', '[v1edgedetect]')
    ->custom('[2:v]', 'hflip', '[v2hflip]')
    ->custom('[3:v]', 'vflip', '[v3vflip]')
    ->xStack('[v0negate][v1edgedetect][v2hflip][v3vflip]', XStackFilter::LAYOUT_2X2, 4, '[resultv]');
$advancedMedia
    ->map(array('0:a'), new Mp3(), 'video_1.mp3')
    ->map(array('1:a'), new Flac(), 'video_2.flac')
    ->map(array('2:a'), new Wav(), 'video_3.wav')
    ->map(array('3:a'), new Aac(), 'video_4.aac')
    ->map(array('[resultv]'), new X264('aac', 'libx264'), 'output.mp4')
    ->save();

This code takes 4 input videos, then the negates the first video, stores result in [v0negate] stream, detects edges in the second video, stores result in [v1edgedetect] stream, horizontally flips the third video, stores result in [v2hflip] stream, vertically flips the fourth video, stores result in [v3vflip] stream, then takes this 4 generated streams ans combine them in one 2x2 collage video. Then saves audios from the original videos into the 4 different formats and saves the generated collage video into the separate file.

As you can see, you can take multiple input sources, perform the complicated processing for them and produce multiple output files in the same time, in the one ffmpeg command.

Just give me a map!

You do not have to use -filter_complex. You can use only -map options. For example, just extract the audio from the video:

$advancedMedia = $ffmpeg->openAdvanced(array('video.mp4'));
$advancedMedia
    ->map(array('0:a'), new Mp3(), 'output.mp3')
    ->save();

Customisation

If you need you can extra customize the result ffmpeg command of the AdvancedMedia:

$advancedMedia = $ffmpeg->openAdvanced($inputs);
$advancedMedia
    ->setInitialParameters(array('the', 'params', 'that', 'will', 'be', 'added', 'before', '-i', 'part', 'of', 'the', 'command'))
    ->setAdditionalParameters(array('the', 'params', 'that', 'will', 'be', 'added', 'at', 'the', 'end', 'of', 'the', 'command'));

Formats

A format implements FFMpeg\Format\FormatInterface. To save to a video file, use FFMpeg\Format\VideoInterface, and FFMpeg\Format\AudioInterface for audio files.

A format can also extend FFMpeg\Format\ProgressableInterface to get realtime information about the transcoding.

Predefined formats already provide progress information as events.

$format = new FFMpeg\Format\Video\X264();
$format->on('progress', function ($video, $format, $percentage) {
    echo "$percentage % transcoded";
});

$video->save($format, 'video.avi');

The callback provided for the event can be any callable.

Add additional parameters

You can add additional parameters to your encoding requests based on your video format.

The argument of the setAdditionalParameters method is an array.

$format = new FFMpeg\Format\Video\X264();
$format->setAdditionalParameters(array('foo', 'bar'));
$video->save($format, 'video.avi');
Add initial parameters

You can also add initial parameters to your encoding requests based on your video format. This can be expecially handy in overriding a default input codec in FFMpeg.

The argument of the setInitialParameters method is an array.

$format = new FFMpeg\Format\Video\X264();
$format->setInitialParameters(array('-acodec', 'libopus'));
$video->save($format, 'video.avi');
Create your own format

The easiest way to create a format is to extend the abstract FFMpeg\Format\Video\DefaultVideo and FFMpeg\Format\Audio\DefaultAudio. and implement the following methods.

class CustomWMVFormat extends FFMpeg\Format\Video\DefaultVideo
{
    public function __construct($audioCodec = 'wmav2', $videoCodec = 'wmv2')
    {
        $this
            ->setAudioCodec($audioCodec)
            ->setVideoCodec($videoCodec);
    }

    public function supportBFrames()
    {
        return false;
    }

    public function getAvailableAudioCodecs()
    {
        return array('wmav2');
    }

    public function getAvailableVideoCodecs()
    {
        return array('wmv2');
    }
}

Coordinates

FFMpeg uses many units for time and space coordinates.

  • FFMpeg\Coordinate\AspectRatio represents an aspect ratio.
  • FFMpeg\Coordinate\Dimension represent a dimension.
  • FFMpeg\Coordinate\FrameRate represent a framerate.
  • FFMpeg\Coordinate\Point represent a point. (Supports dynamic points since v0.10.0)
  • FFMpeg\Coordinate\TimeCode represent a timecode.

FFProbe

FFMpeg\FFProbe is used internally by FFMpeg\FFMpeg to probe medias. You can also use it to extract media metadata.

$ffprobe = FFMpeg\FFProbe::create();
$ffprobe
    ->streams('/path/to/video/mp4') // extracts streams informations
    ->videos()                      // filters video streams
    ->first()                       // returns the first video stream
    ->get('codec_name');            // returns the codec_name property
$ffprobe = FFMpeg\FFProbe::create();
$ffprobe
    ->format('/path/to/video/mp4') // extracts file informations
    ->get('duration');             // returns the duration property

Validating media files

(since 0.10.0) You can validate media files using PHP-FFMpeg's FFProbe wrapper.

$ffprobe = FFMpeg\FFProbe::create();
$ffprobe->isValid('/path/to/file/to/check'); // returns bool

License

This project is licensed under the MIT license.

Music: "Favorite Secrets" by Waylon Thornton From the Free Music Archive CC BY NC SA

Music: "Siesta" by Jahzzar From the Free Music Archive CC BY SA

php-ffmpeg's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

php-ffmpeg's Issues

Support for WAV encoding

I have a basic WAV encoder. I think this should be a standard format for this library. Can i submit a pull request?

[Question] Usage without ffprobe

Is there a way to use this without having ffprobe installed?
Or is there a quick way to install it on OSX without compiling?

The problem is, that there are compiled binaries for ffmpeg, but not for ffprobe for OSX.

THX. Frank

Problem with two-pass video encoding.

When using the '-pass' FFMpeg in this write statistics in a log file, the parameter '-passlogfile' allows you to specify the name of the log file, but the current version does not specify the name of the log during the convertion of a video.

Cella problem when two FFMpeg running simultaneously on the server, because both can post at the same time in the log. Or even a writing statistics during the first pass and the second bed in the stats second pass and thus encoding plant.

It would be enough to change this part of code to add the parameter '-passlogfile' using log as the name, the name of the video input or output.

         $ passes [] = $ cmd_part1. 'One-pass'. $ cmd_part2
             . '-An'. escapeshellarg ($ tmpfile-> getPathname ());

         $ passes [] = $ cmd_part1. '-Pass 2'. $ cmd_part2
             . '-Ac 2-ar 44100'. escapeshellarg ($ outputPathfile);

Thank you.

Video::save() cannot be called multiple times

Video::save() has the side-effect of adding filters, which means that you can't reliably call it multiple times.

Here's an example:

$source = $ffmpeg->open('source.avi');

$source->save(new \FFMpeg\Format\Video\WebM(), 'processed.webm');

//This fails, because $source was "contaminated" with filters,
//which added params like "-f webm", etc.
$source->save(new \FFMpeg\Format\Video\X264(), 'processed.mp4');

Audio::save() likely exhibits the same behavior.

IMO, this should either be fixed by:

  • removing the side-effects - moving from $this->addFilter() calls to a new local FiltersCollection
  • documenting the current behavior

Set video bitrate

Hello and thanks for this awesome wrapper. I've been experimenting with it for a few hours now and finally got things running the way I'd like them to except for one thing, the bitrate.

How do I go about setting the bitrate for the conversions, it's really essential as I need to be able to control the quality.

Thanks in advance,
Jonathan

How to debug a failed encoding?

How do I get a more specific reason for a failure when encoding? Is it possible, even?

At the moment I just get an error like this:

exception 'Alchemy\BinaryDriver\Exception\ExecutionFailureException' with message 'ffmpeg failed to execute command '/usr/bin/ffmpeg' '-y' '-i' '/var/www/resources/original-videos/4.mov' '-vcodec' 'libx264' '-acodec' 'libfaac' '-b:v' '1000k' '-refs' '6' '-coder' '1' '-sc_threshold' '40' '-flags' '+loop' '-me_range' '16' '-subq' '7' '-i_qfactor' '0.71' '-qcomp' '0.6' '-qdiff' '4' '-trellis' '1' '-b:a' '128k' '-pass' '1' '-passlogfile' '/tmp/ffmpeg-passes531338a937a85kp7dv/pass-531338a937d92' '/var/www/resources/processing/4/videos/default.mp4'' in /var/www/vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/ProcessRunner.php:100

There's also another exception:

Next exception 'FFMpeg\Exception\RuntimeException' with message 'Encoding failed' in /var/www/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Media/Video.php:165

Obviously, these do not provide much help. I may be missing a codec or something, but how do I find that out?

rotation x resize issue

Since we have a rotation filter, applying rotation of 90° or 270° and resize filter on the same media results in a wrong output if the resize mode is not set to fit.

As resize computes final dimension based on the source dimension, as width and height are inverted in case of a 90° (counter) clockwise rotation.

There are multiple solutions to this issue :

  • Merge resize and rotate filter so the dimension computation mechanism would know if source dimensions should be inverted
  • Decouple dimension computation mechanism from the resize filter and I don't have yet the solution
  • Attach metadata to the media so that filters could update them, later filters would get these updated data.

I'm more in favor of the last solution. Any ideas ?

Symfony 2.0 compatible ?

Composer.json indicate the following :

"require": {
"php" : ">=5.3.3",
"symfony/process" : "~2.0"

The problem being that symfony version 2.0 doesn't include any library called "processBuilder" in FFProbe.php (use Symfony\Component\Process\ProcessBuilder;).

The processBuilder appear in the symfony2 api only from symfony 2.1. (source : http://api.symfony.com/2.0/index.html)

Resulting in the following error :

Fatal error: Class 'Symfony\Component\Process\ProcessBuilder' not found in /path/Symfony/vendor/PHP-FFmpeg-master/src/FFMpeg/FFProbe.php on line 96

"Encoding failed" with nginx and php-fpm

I got this error every time I try to run the script

FFMpeg\Exception\RuntimeException

File: vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Media/Video.php:148
Message: Encoding failed

ffmpeg failed to execute command '/usr/bin/ffmpeg' '-y' '-i' '/tmp/php8aiScI' '-s' '1024x554' '-threads' '12' '-vcodec' 'libx264' '-acodec' 'libmp3lame' '-b:v' '1000k' '-refs' '6' '-coder' '1' '-sc_threshold' '40' '-flags' '+loop' '-me_range' '16' '-subq' '7' '-i_qfactor' '0.71' '-qcomp' '0.6' '-qdiff' '4' '-trellis' '1' '-b:a' '128k' '-pass' '1' '-passlogfile' 'pass-5231cb6a9085e' '/tmp/video97410_6e1fd0a1dc77c18b94da7f8210d331f8.mp4'

But if I ran it manually in the command-line it works fine (the ffmpeg command)

I also tried this solution you have in other project, but it doesn't solve the issue

FFProbe not found, PHP-FFmpeg not working...

Similar to issue #45, I seem to have a problem loading FFProbe (but that issue didn't actually present any working solution).
I use Xampp (32-bit version) on a Windows 7 (64-bit) computer.
PHP version is 5.4.7.

Before trying PHP-FFmpeg I had (and still have) ffmpeg-php installed.
After a fruitless search for decent (install) information about ffmpeg-php, I found out it was simply too slow, so therefore I resorted to PHP-FFmpeg, hoping for a better experience.
Alas, for PHP-FFmpeg I found even less information, and no information at all about solving problems...
So any help is very welcome.

This is the expetion php throws at me...
Uncaught exception 'Alchemy\BinaryDriver\Exception\ExecutableNotFoundException' with message 'Executable not found, proposed : avprobe, ffprobe' in path\to\vendor\Alchemy\binary-driver\src\Alchemy\BinaryDriver\AbstractBinary.php:160
Stack trace:
-0 path\to\vendor\php-ffmpeg\php-ffmpeg\src\FFMpeg\Driver\FFProbeDriver.php(48): Alchemy\BinaryDriver\AbstractBinary::load(Array, NULL, Object(Alchemy\BinaryDriver\Configuration))
-1 path\to\vendor\php-ffmpeg\php-ffmpeg\src\FFMpeg\FFProbe.php(206): FFMpeg\Driver\FFProbeDriver::create(Array, NULL)
-2 path\to\vendor\php-ffmpeg\php-ffmpeg\src\FFMpeg\FFMpeg.php(118): FFMpeg\FFProbe::create(Array, NULL, NULL)
-3 path\to\script.php(20) in path\to\vendor\php-ffmpeg\php-ffmpeg\src\FFMpeg\Driver\FFProbeDriver.php on line 50

Some code causes inconsistant aspect ratio

I have been encoding my videos into a variety of resolutions and was noticing some were consistently out of line with the others. This causes a very jarring effect when you transition from one resolution to another. I use the RESIZEMODE_INSET setting and first thought it may be due to the method getComputedDimensions in the class DefaultVideo but I pulled the code out and tested it and it was fine. then I found this at line 336 in the FFMpeg class.

$width = $this->getMultiple($dimensions->getWidth(), 16);
$height = $this->getMultiple($dimensions->getHeight(), 16);

in my case this mucks up getComputedDimensions and makes my resolutions very inconsistent with each other. I think its purpose is to try and prevent invalid resolutions but it would be nice to be able to override it.

Optimization for image extraction

The change is especially useful on long videos because the seek is more important.
I changed the file in this FFMpeg.php php-ffmpeg/php-ffmpeg/src/FFMpeg.

before:
         $ cmd = $ this-> binary
             . '-I'. escapeshellarg ($ this-> pathfile)
             . 'Vframes-1-ss'. $ time
             . '-F image2'. escapeshellarg ($ output);

FFMpeg command:
ffmpeg-i '/ home/720_document.mp4' vframes-1-f image2-ss 2278 '/ home / test.jpg'

after:
         $ cmd = $ this-> binary
             . '-ss'. $ time
             . '-I'. escapeshellarg ($ this-> pathfile)
             . '-F image2-1 vframes'. escapeshellarg ($ output);

FFMpeg command:
ffmpeg-ss 2278-i '/ home/720_document.mp4'-f image2-1 vframes '/ home / test.jpg'

Test result with a seek of 2278:
before:
time ffmpeg-i '/ home/720_document.mp4' vframes-1-f image2-ss 2278 '/ home / test.jpg'
real 4m21.061s
user 4m18.851s
sys 0m1.627s

after:
time ffmpeg-ss 2278-i '/ home/720_document.mp4'-f image2-1 vframes '/ home / test.jpg'
real 0m0.732s
user 0m0.104s
sys 0m0.023s

thank you

Encoding Failed

I am running the basic script provided in the documentation. This is on a linux server. I am using a .mov file for testing. The frame is generated but the encoding fails with the following error.

exception 'Alchemy\BinaryDriver\Exception\ExecutionFailureException' with message 'ffmpeg failed to execute command '/usr/bin/ffmpeg' '-y' '-i' 'Algonquin elevators 4.mov' '-f' 'webm' '-vcodec' 'libvpx' '-acodec' 'libvorbis' '-b:v' '1000k' '-refs' '6' '-coder' '1' '-sc_threshold' '40' '-flags' '+loop' '-me_range' '16' '-subq' '7' '-i_qfactor' '0.71' '-qcomp' '0.6' '-qdiff' '4' '-trellis' '1' '-b:a' '128k' 'export-webm.webm'' in /var/www/aims/vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/ProcessRunner.php:100 Stack trace: #0 /var/www/aims/vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/ProcessRunner.php(72): Alchemy\BinaryDriver\ProcessRunner->doExecutionFailure(''/usr/bin/ffmpe...') #1 /var/www/aims/vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/AbstractBinary.php(209): Alchemy\BinaryDriver\ProcessRunner->run(Object(Symfony\Component\Process\Process), Object(SplObjectStorage), false) #2 /var/www/aims/vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/AbstractBinary.php(137): Alchemy\BinaryDriver\AbstractBinary->run(Object(Symfony\Component\Process\Process), false, Array) #3 /var/www/aims/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Media/Video.php(155): Alchemy\BinaryDriver\AbstractBinary->command(Array, false, Array) #4 /var/www/aims/ffmpeg-test/index.php(37): FFMpeg\Media\Video->save(Object(FFMpeg\Format\Video\WebM), 'export-webm.web...') #5 {main} Next exception 'FFMpeg\Exception\RuntimeException' with message 'Encoding failed' in /var/www/aims/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Media/Video.php:165 Stack trace: #0 /var/www/aims/ffmpeg-test/index.php(37): FFMpeg\Media\Video->save(Object(FFMpeg\Format\Video\WebM), 'export-webm.web...') #1 {main}

The ffmpeg is working good through cmd line, also it works if I run shell_exec

shell_exec("ffmpeg -i Algonquin elevators 4.mov output.webm &");

Change Binary timeout to maintain backward compatibility

In 0.2.1, a new function process timeout customization appeared which arrived with one minute timeout on any conversation process.

I think it would be better to set it to 0 to maintain backward compatibility with previous versions.

PHP-FFMPEG throws runtime exception but the the ffmpeg process is still running.

Hi,

First of all, I would like to thank you for the awesome library you have built.

I have been using PHP-FFMpeg for couple of months and it has been great. Yesterday, My server had utilized its CPU 100%. looking into the cause I realized that there were quite few processes running ffmpeg. It turns out that my worker was trying to encode an avi file, but each time it would fail because of a frame sync error and it would start again trying to encode the file again. But each time that it failed, the background process created by PHP-FFMpeg to run ffmpeg was still running so the server ended up with few ffmpeg processes that slowed down the server. When I ran the command manually, I noticed that ffmpeg threw an error complaining about frame sync error and it then continued to encode the file afterwards. the encoded video actually had good quality. I saw the same issue when my worker failed due to encoding taking longer than expected but when i checked the background process was still running. here is the message I got:

[Symfony\Component\Process\Exception\ProcessTimedOutException]
The process "'/usr/bin/ffmpeg' '-y' '-i' '/home/taher/public_html/phonics.com/app/../web/uploads/5328ce9822be2.avi' '-f' 'webm' '-threads' '12' '-vcodec' 'libvpx' '-acodec' 'libvorbis' '-b:v' '1000k' '-refs' '6' '-coder' '1' '-sc_threshold' '40' '-flags' '+loop' '-me_range' '16' '-subq' '7' '-i_qfactor' '0.71' '-qcomp' '0.6' '-qdiff' '4' '-trellis' '1' '-b:a' '128k' '/home/taher/public_html/phonics.com/app/../web/uploads/5328d82329f8b.webm'" exceeded the timeout of 3600 seconds.

However, the background process doing the encoding is still running:

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
29057 taher 20 0 1055m 31m 5600 R 570 0.4 434:47.50 ffmpeg

Here is my code:

$ffmpeg->open($path)
->save(new Video\WebM(), $webmPath)
->save(new Video\X264(), $mp4Path);

Is there a way to configure php-ffmpeg to just log errors like this and continue with encoding and only throw exceptions if the background ffmpeg process exites with failure. Is there a way to make sure that the background process stops if php-ffmpeg throws an exception?

Thanks
Taher

Unable to load FFProbe - WAMP

I am able to run the ffmpeg and ffprobe through command line but in the browser it gives me "Unable to load FFProbe" error. I have followed steps mentioned in #64

Symfony2 ProcessUtils escapeshellarg() warning

Hello,

I got issue with php-ffmpeg/php-ffmpeg 0.4 with symfony 2.4.

Stacktrace:

ContextErrorException: Warning: escapeshellarg() expects parameter 1 to be string, resource given in /home/kofel/src/intranet/vendor/symfony/symfony/src/Symfony/Component/Process/ProcessUtils.php line 72
in /home/kofel/src/intranet/vendor/symfony/symfony/src/Symfony/Component/Process/ProcessUtils.php line 72
at ErrorHandler->handle('2', 'escapeshellarg() expects parameter 1 to be string, resource given', '/home/kofel/src/intranet/vendor/symfony/symfony/src/Symfony/Component/Process/ProcessUtils.php', '72', array('argument' => resource))
at escapeshellarg(resource) in /home/kofel/src/intranet/vendor/symfony/symfony/src/Symfony/Component/Process/ProcessUtils.php line 72
at ProcessUtils::escapeArgument(resource)
at array_map(array('Symfony\Component\Process\ProcessUtils', 'escapeArgument'), array('/usr/bin/avconv', '-y', '-i', '/tmp/phpTd3NwJ', '-async', '1', '-metadata:s:v:0', 'start_time=0', '-s', '640x480', '-vcodec', 'libx264', '-acodec', 'libfaac', '-b:v', '1000k', '-refs', '6', '-coder', '1', '-sc_threshold', '40', '-flags', '+loop', '-me_range', '16', '-subq', '7', '-i_qfactor', '0.71', '-qcomp', '0.6', '-qdiff', '4', '-trellis', '1', '-b:a', '128k', '-pass', '1', '-passlogfile', '/tmp/ffmpeg-passes5343e3b0f04499zm9i/pass-5343e3b0f04f6', resource)) in /home/kofel/src/intranet/vendor/symfony/symfony/src/Symfony/Component/Process/ProcessBuilder.php line 166
at ProcessBuilder->getProcess() in /home/kofel/src/intranet/vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/ProcessBuilderFactory.php line 163
at ProcessBuilderFactory->create(array('-y', '-i', '/tmp/phpTd3NwJ', '-async', '1', '-metadata:s:v:0', 'start_time=0', '-s', '640x480', '-vcodec', 'libx264', '-acodec', 'libfaac', '-b:v', '1000k', '-refs', '6', '-coder', '1', '-sc_threshold', '40', '-flags', '+loop', '-me_range', '16', '-subq', '7', '-i_qfactor', '0.71', '-qcomp', '0.6', '-qdiff', '4', '-trellis', '1', '-b:a', '128k', '-pass', '1', '-passlogfile', '/tmp/ffmpeg-passes5343e3b0f04499zm9i/pass-5343e3b0f04f6', resource)) in /home/kofel/src/intranet/vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/AbstractBinary.php line 137
at AbstractBinary->command(array('-y', '-i', '/tmp/phpTd3NwJ', '-async', '1', '-metadata:s:v:0', 'start_time=0', '-s', '640x480', '-vcodec', 'libx264', '-acodec', 'libfaac', '-b:v', '1000k', '-refs', '6', '-coder', '1', '-sc_threshold', '40', '-flags', '+loop', '-me_range', '16', '-subq', '7', '-i_qfactor', '0.71', '-qcomp', '0.6', '-qdiff', '4', '-trellis', '1', '-b:a', '128k', '-pass', '1', '-passlogfile', '/tmp/ffmpeg-passes5343e3b0f04499zm9i/pass-5343e3b0f04f6', resource), false, array(object(VideoProgressListener))) in /home/kofel/src/intranet/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Media/Video.php line 155
at Video->save(object(X264), resource) in /home/kofel/src/intranet/src/Berg/Intranet/KnowledgeBundle/Controller/KnowledgeController.php line 363
at KnowledgeController->videoUploadAction(object(Request))
at call_user_func_array(array(object(KnowledgeController), 'videoUploadAction'), array(object(Request))) in /home/kofel/src/intranet/app/bootstrap.php.cache line 2929
at HttpKernel->handleRaw(object(Request), '1') in /home/kofel/src/intranet/app/bootstrap.php.cache line 2901
at HttpKernel->handle(object(Request), '1', true) in /home/kofel/src/intranet/app/bootstrap.php.cache line 3040
at ContainerAwareHttpKernel->handle(object(Request), '1', true) in /home/kofel/src/intranet/app/bootstrap.php.cache line 2307
at Kernel->handle(object(Request)) in /home/kofel/src/intranet/web/app_dev.php line 30
at require('/home/kofel/src/intranet/web/app_dev.php') in /home/kofel/src/intranet/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/config/router_dev.php line 30

Snippet code:

        $ffmpeg = \FFMpeg\FFMpeg::create();
        $video = $ffmpeg->open((string) $file);

        $video
            ->filters()
            ->resize(new \FFMpeg\Coordinate\Dimension(640, 480))
            ->synchronize();

        $mp4tmp = tmpfile();
        $webmtmp = tmpfile();

        $video
            ->save(new \FFMpeg\Format\Video\X264(), $mp4tmp)
            ->save(new \FFMpeg\Format\Video\WebM(), $webmtmp);

$file is just Symfony's UploadedFile object.

Unable to load FFProbe

I know this isn't exactly an issue with this package, but I have this error: "Unable to load FFProbe", and there does not seem to be any FFProbe binaries in the entire internet for PHP (5.4). FFMpeg is installed and working, but can't find anything on Probe. Running windows WAMP server for development and Linux server for production, if anyone has any ideas where to get these.

Timecode or TimeCode ?

I guess there is an issue with FFMpeg\Media\Video : the public function frame() (line 156) seems to use ' Timecode $at ' (with no capital C) in its signature for FFMpeg\Coordinate\TimeCode

I did not tried yet but I guess its going to issue an error :)

Create frame

I am developing an application with laravel and I am using php ffmpeg to do multiple things, probe, extract frame and encode. I am having an issue with creating a frame from the uploaded video file.
This is how I am creating the frame:
$video = $ffmpeg->open($destinationPath.'/'.$filename);

        $video
            ->frame(FFMpeg\Coordinate\TimeCode::fromSeconds(10))
            ->save(public_path().$frame_path);

This is sometimes working and other times not. I noticed that this bug comes up when I am trying to open a .mov file.

Map audio stream

I would like to know if it's possible to save a video with only one audio.

Comming from a MULTI Audio video, let's say I only want the second Audio stream with my video.

With ffmpeg I would use the -map option.

Any help would be appreciated.

thanks a lot

Custom enconding settings

How can I specify custom encoding settings? save method currently has hardcoded settings, is it possible to specify my own?

Video Synchronize filter synchronize but leaves metadata

Videos are rendered correctly in players that do not care about this sync metadata (purpose of the filter) but when playing in quick time player (that takes care about metadata), desynchronisation occurs.

Metadata should be removed.

FFProbe - bit rate information per stream

First, many thanks for this impressive library.
FFMpeg \ ffprobe provides a lot of metadata and the format () method also returns bit_rate property for all streams.
It would be nice to have bit rate also for each stream separately.

Any way to use it without composer?

Sorry for posting this here, but I can't find any forum nor mailing list. If one exists, I can't find any link to it.

Is it possible to use this library without relying on Composer? I have php 5.1.6 so I can't install composer.

Your FFProbe version is too old and does not support `-help` option, please upgrade.

When trying to use FFprobe in this package, it throws an exception saying it is too old, yet I have upgraded to the latest version of FFmpeg and FFprobe, and running ffprobe -help works in the console/terminal.

Installed the package via composer as so:

"require": {
  "php-ffmpeg/php-ffmpeg": "0.4.4"
}

The error traces to line 60 of /vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/FFProbe/OptionsTester.php:

try {
  $output = $this->ffprobe->command(array('-help', '-loglevel', 'quiet'));
} catch (ExecutionFailureException $e) {
  throw new RuntimeException('Your FFProbe version is too old and does not support `-help` option, please upgrade.', $e->getCode(), $e);
}

This is locally on a Mac OS 10.9.1, I've updated FFmpeg via:

brew update
brew upgrade ffmpeg

This upgraded my ffmpeg and ffprobe versions to 1.2.4, as ffmpeg -version and ffprobe -version, both give 1.2.4.

I've created an FFprobe instance with configuration passed through it, with the binary paths I get from executing which ffmpeg and which ffprobe. But then when trying to read a file, it throws the exception:

$config = array(
 'ffmpeg.binarie' => '/usr/local/bin/ffmpeg'
 'ffprobe.binaries' => '/usr/local/bin/ffprobe'
 'timeout' => 3600
 'ffmpeg.threads' => 12
)

$ffprobe = FFMpeg\FFProbe::create($config);

$file_path = '/htdocs/mp4/test1.mp4';

$file_info = $ffprobe
  ->streams($file_path)
  ->videos()
  ->first()
  ->get('duration');


echo '<pre>';
print_r($file_info);
echo '</pre>';

Any thoughts as to why or how to fix? Many thanks!

Run video encoding in background

I use PHP-FFmpeg for online video encoding, and it's very useful...But I need to allow users to do other things during video encoding.

In other words, the php script must proceed after call of PHP-FFmpeg's save function, like the "ffmpeg" command has "&" option.

Can PHP-FFmpeg do this ?

Thanks, and sorry for my bad english.

Remote File Frame Grabbing

Hi,

This is probably an enhancement, not an issue.
If I disable the "is_file" and "is_readable" checks, the frame grabbing will work with a remote URL - e.g. an http link to a video hosted on S3.

Support for this would be fantastic for what we are trying to do. I'll try and create a fork and send a pull request, but I'm not going to have time for a few weeks - if someone else knows of any quick fixes or reasons why I shouldn't do this, please let me know.

Thanks,
James.

Set frame dimension

Hello!

When you choose to save a frame from the video, is there any way to make it save the video in a specific dimension. In my case I want to create posters and thumbnails, so I have to save two different times, but I'd like to have different dimensions.

Allow multiple streams stream as input

I am using this ffmpeg command in my PHP script and came across your library, I am particularly interested in the "progress" provided by this library. I am not very proficient to programming and would like to ask whether equivalent of this is possible in PHP-FFmpeg.

ffmpeg -i $aacAudioStreamURL -i $mp4VideoStreamURL -acodec copy -vcodec copy -f matroska -map_metadata -1 out.mp4

Unknown errors thrown but actual FFMpeg command works...

Hi,

First congrat for the work done on PHP-FFmpeg!

I'm using it together with a PHP Job/Queue system to manage video encodings on a distributed architecture. Sadly I've encounter some very strange behaviors during the debug phase.

I'm working on :

  • Ubuntu 12.04 LTS server
  • PHP5.3.23 (dotdeb) with Suhosin-Patch
  • FFMpeg 1.2

I do apply many processes (= FFMpeg commands) on each submitted video.
For example I'm encoding two H264/FLV videos : one in HD (720p) the other in LD (360p).
Those two LD/HD videos use exactly the same settings (= FFMpeg arguments).

Still, each time I use PHP-FFmpeg the Symfony Process fails before the HD is completly encoded. It sends back an error with exit code "15" or "-1" (it seems those are unknown error in both case).

Note that there is no problem when I run the PHP-FFMpeg generated command manually. Moreover I can't find any track of an error in the exception thrown by PHP-FFMpeg's symfony Process execution...

Here is the command generated by ProcessBuilder:

'/usr/local/bin/ffmpeg' '-y' '-i' '/tmp/video/original/adf7aaec5eb3a381ca67a10813c88c714814fe7e.mov' '-maxrate' '2560k' '-profile:v' 'high' '-preset' 'fast' '-s' '1280x720' '-r' '25' '-b_strategy' '1' '-bf' '3' '-g' '25' '-vcodec' 'libx264' '-b:v' '2048k' '-threads' '1' '-refs' '6' '-coder' '1' '-sc_threshold' '40' '-flags' '+loop' '-me_range' '16' '-subq' '7' '-i_qfactor' '0.71' '-qcomp' '0.6' '-qdiff' '4' '-trellis' '1' '-b:a' '92k' '-acodec' 'libmp3lame' '-ac' '2' '-ar' '44100' '/tmp/video/front/flv_hd/adf7aaec5eb3a381ca67a10813c88c714814fe7e.flv'

Here is an example of the output from the thrown exception:

ffmpeg version 1.2 Copyright (c) 2000-2013 the FFmpeg developers
  built on Apr 16 2013 12:32:12 with gcc 4.4.3 (Ubuntu 4.4.3-4ubuntu5.1)
  configuration: --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-version3
  libavutil      52. 18.100 / 52. 18.100
  libavcodec     54. 92.100 / 54. 92.100
  libavformat    54. 63.104 / 54. 63.104
  libavdevice    54.  3.103 / 54.  3.103
  libavfilter     3. 42.103 /  3. 42.103
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/tmp/video/original/adf7aaec5eb3a381ca67a10813c88c714814fe7e.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 537199360
    compatible_brands: qt  
    creation_time   : 2009-08-05 14:51:58
  Duration: 00:00:47.76, start: 0.000000, bitrate: 9838 kb/s
    Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1280x720, 9695 kb/s, 25 fps, 25 tbr, 2500 tbn, 5k tbc
    Metadata:
      creation_time   : 2009-08-05 14:51:58
      handler_name    : Gestionnaire d?alias Apple
    Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 129 kb/s
    Metadata:
      creation_time   : 2009-08-05 14:51:58
      handler_name    : Gestionnaire d?alias Apple
[libx264 @ 0x9db9740] VBV maxrate specified, but no bufsize, ignored
[libx264 @ 0x9db9740] using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64 SlowShuffle
[libx264 @ 0x9db9740] profile High, level 4.0
[libx264 @ 0x9db9740] 264 - core 130 r2 c832fe9 - H.264/MPEG-4 AVC codec - Copyleft 2003-2013 - http://www.videolan.org/x264.html - options: cabac=1 ref=6 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=3 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=1 keyint=25 keyint_min=2 scenecut=40 intra_refresh=0 rc_lookahead=25 rc=abr mbtree=1 bitrate=2048 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.41 aq=1:1.00
Output #0, flv, to '/tmp/video/front/flv_hd/adf7aaec5eb3a381ca67a10813c88c714814fe7e.flv':
  Metadata:
    major_brand     : qt  
    minor_version   : 537199360
    compatible_brands: qt  
    encoder         : Lavf54.63.104
    Stream #0:0(eng): Video: h264 ([7][0][0][0] / 0x0007), yuv420p, 1280x720, q=-1--1, 2048 kb/s, 1k tbn, 25 tbc
    Metadata:
      creation_time   : 2009-08-05 14:51:58
      handler_name    : Gestionnaire d?alias Apple
    Stream #0:1(eng): Audio: mp3 ([2][0][0][0] / 0x0002), 44100 Hz, stereo, fltp, 92 kb/s
    Metadata:
      creation_time   : 2009-08-05 14:51:58
      handler_name    : Gestionnaire d?alias Apple
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> libx264)
  Stream #0:1 -> #0:1 (aac -> libmp3lame)
Press [q] to stop, [?] for help
'. [] []645 fps= 11 q=29.0 size=    7504kB time=00:00:26.41 bitrate=2327.4kbits/s

I hope you'll be able to help me on this.
Thank you for your time!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.