Recommend this page to a friend! |
![]() |
Info | Documentation | ![]() |
![]() |
![]() |
Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
![]() ![]() ![]() ![]() | Total: 4,031 | All time: 776 This week: 53![]() |
Version | License | PHP version | Categories | |||
ffmpeg-php 3.0.4 | BSD License | 7.1 | PHP 5, Audio, Video |
Description | Author | |||||||||||||
This package can be used to manipulate videos files in PHP using the ffmpeg program. |
|
API or class for detecting video meta data
I need to get meta data for a video like frame-rate, length etc
FFmpegPHP is a pure OO PSR-4 compatible PHP port of ffmpeg-php library (that was written in C). It adds an easy to use, object-oriented API for accessing and retrieving information from video and audio files. It has methods for returning frames from movie files as images that can be manipulated using PHP image functions. This works well for automatically creating thumbnail images from movies. FFmpegPHP is also useful for reporting the duration and bitrate of audio files (mp3, wma...). FFmpegPHP can access many of the video formats supported by ffmpeg (mov, avi, mpg, wmv...)
FFmpegPHP can be used as a drop in replacement for ffmpeg-php library.
FFmpegPHP API documentation can be found here http://char0n.github.io/ffmpeg-php/.
Grab the source code located in src/
directory and use it as you seem appropriate.
Grab the composer.phar
which can install packages published on packagist.
$ wget https://raw.githubusercontent.com/composer/getcomposer.org/1b137f8bf6db3e79a38a5bc45324414a6b1f9df2/web/installer -O - -q | php
This command will create file called composer.phar
.
Create a file called composer.json
and paste the following JSON into it:
{
"require": {
"char0n/ffmpeg-php": "^3.0.0"
}
}
Install the FFmpegPHP by running the following command:
$ php composer.phar install
After this command is successfully executed, the new directory called vendor/
is created.
File structure of your current working directory should now look like this:
- composer.json
- composer.phar
- vendor/
To verify that everything works as expected create new file called test.php
inside your current working
directory with the following content.
<?php
require_once './vendor/autoload.php';
use Char0n\FFMpegPHP\Movie;
$movie = new Movie('./test.mp4');
var_dump($movie->getDuration());
Before you run the script you need to also download the testing movie file:
$ wget https://github.com/char0n/ffmpeg-php/raw/master/tests/data/test.mp4
Now run it.
$ php test.php
The output should be something similar to the following:
float(32.14)
Note
Notice the first line (require './vendor/autoload.php';
) in the above script. This line is
necessary because it configures how the FFmpegPHP will be included into your scripts and it
auto-magically knows where to look for FFmpegPHP.
FFmpegPHP is build using PSR-4 standard and it's interface is purely Object Oriented. We're using standar OOP patterns to create our API.
use Char0n\FFMpegPHP\Movie;
$movie = new Movie('/path/to/media.mpeg');
$movie->getDuration(); // => 24
On top of our OO interface, there is an additional one that provides full compatibility with original ffmpeg-php library.
use Char0n\FFMpegPHP\Adapters\FFMpegMovie as ffmpeg_movie;
$movie = new ffmpeg_movie('/path/to/media.mpeg');
$movie->getDuration(); // => 24
GoDaddy started to use FFmpegPHP as part of it's services from November 2018. If you need a server with ffmpeg and FFmpegPHP installed on it contact GoDaddy and they'll do it for you as part of its "Expert Service". As author of FFmpegPHP I agreed to provide support for users coming from GoDaddy asking about FFmpegPHP. All incoming GoDaddy customers, please use GitHub issues as a support channel.
![]() |
File | Role | Description | ||
---|---|---|---|---|
![]() |
||||
![]() |
||||
![]() |
||||
![]() |
||||
![]() |
||||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Lic. | License text | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Doc. | Documentation |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
![]() |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
90% |
|
|
User Ratings | User Comments (1) | ||||||||||||||||||||||||||||||||||
|
|
Applications that use this package |
Video sharing system |
free online service allowing you to convert and download Videos to MP3 with ease |
If you know an application of this package, send a message to the author to add a link here.
Related pages |
FFmpegPHP git repository |
FFmpegPHP Homepage |
FFmpegPHP PEAR installer channel |
Pages that reference this package |
Thanks to Vladimir and his script are burning FFmpeg PHP published on phpclasses.org made it possible. |