Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork93
FFmpegPHP is a pure OO 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's image functions. This works well for automatically creatin…
License
char0n/ffmpeg-php
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
FFmpegPHP is a pure OOPSR-4 compatible PHP port offfmpeg-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 manipulatedusing 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 forffmpeg-php library.
FFmpegPHP API documentation can be found herehttp://char0n.github.io/ffmpeg-php/.
- PHP >=7
- PHP extensions: gd, mbstring, xml
- ffmpeg or ffprobe
Grab the source code located insrc/ directory and use it as you seem appropriate.
Grab thecomposer.phar which can install packages published onpackagist.
$ wget https://raw.githubusercontent.com/composer/getcomposer.org/1b137f8bf6db3e79a38a5bc45324414a6b1f9df2/web/installer -O - -q| phpThis command will create file calledcomposer.phar.
Create a file calledcomposer.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 calledvendor/ 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 calledtest.php inside your current workingdirectory with the following content.
<?phprequire_once'./vendor/autoload.php';useChar0n\FFMpegPHP\Movie;$movie =newMovie('./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 isnecessary because it configures how the FFmpegPHP will be included into your scripts and itauto-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 standarOOP patterns to create our API.
useChar0n\FFMpegPHP\Movie;$movie =newMovie('/path/to/media.mpeg');$movie->getDuration();// => 24
On top of our OO interface, there is an additional one that provides full compatibility with originalffmpeg-php library.
useChar0n\FFMpegPHP\Adapters\FFMpegMovieasffmpeg_movie;$movie =newffmpeg_movie('/path/to/media.mpeg');$movie->getDuration();// => 24
GoDaddy started to use FFmpegPHP as part of it's servicesfrom November 2018. If you need a server withffmpegandFFmpegPHP installed on itcontact 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 comingfrom GoDaddy asking about FFmpegPHP. All incoming GoDaddy customers,please useGitHub issuesas a support channel.
- char0n (Vladimír Gorej)
- email:vladimir.gorej@gmail.com
- web:https://www.linkedin.com/in/vladimirgorej/
About
FFmpegPHP is a pure OO 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's image functions. This works well for automatically creatin…
Topics
Resources
License
Code of conduct
Contributing
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Packages0
Uh oh!
There was an error while loading.Please reload this page.