Sign In
Password Recovery Register

ffmpeg example script

No description :/

 1 <?php
 2 /**
 3  * FFMPEG-PHP Test Script
 4  *
 5  * Special thanks to http://www.sajithmr.me/ffmpeg-sample-code for this code example!
 6  * See the tutorial at http://myownhomeserver.com on how to install ffmpeg-php.
 7  */
 8 // Check if the ffmpeg-php extension is loaded first
 9 extension_loaded('ffmpeg') or die('Error in loading ffmpeg');
10 
11 // Determine the full path for our video
12 $vid = realpath('./vid2.avi');
13 
14 // Create the ffmpeg instance and then display the information about the video clip.
15 $ffmpegInstance = new ffmpeg_movie($vid);
16 echo "getDuration: " . $ffmpegInstance->getDuration() . "<br />".
17 "getFrameCount: " . $ffmpegInstance->getFrameCount() . "<br />".
18 "getFrameRate: " . $ffmpegInstance->getFrameRate() . "<br />".
19 "getFilename: " . $ffmpegInstance->getFilename() . "<br />".
20 "getComment: " . $ffmpegInstance->getComment() . "<br />".
21 "getTitle: " . $ffmpegInstance->getTitle() . "<br />".
22 "getAuthor: " . $ffmpegInstance->getAuthor() . "<br />".
23 "getCopyright: " . $ffmpegInstance->getCopyright() . "<br />".
24 "getArtist: " . $ffmpegInstance->getArtist() . "<br />".
25 "getGenre: " . $ffmpegInstance->getGenre() . "<br />".
26 "getTrackNumber: " . $ffmpegInstance->getTrackNumber() . "<br />".
27 "getYear: " . $ffmpegInstance->getYear() . "<br />".
28 "getFrameHeight: " . $ffmpegInstance->getFrameHeight() . "<br />".
29 "getFrameWidth: " . $ffmpegInstance->getFrameWidth() . "<br />".
30 "getPixelFormat: " . $ffmpegInstance->getPixelFormat() . "<br />".
31 "getBitRate: " . $ffmpegInstance->getBitRate() . "<br />".
32 "getVideoBitRate: " . $ffmpegInstance->getVideoBitRate() . "<br />".
33 "getAudioBitRate: " . $ffmpegInstance->getAudioBitRate() . "<br />".
34 "getAudioSampleRate: " . $ffmpegInstance->getAudioSampleRate() . "<br />".
35 "getVideoCodec: " . $ffmpegInstance->getVideoCodec() . "<br />".
36 "getAudioCodec: " . $ffmpegInstance->getAudioCodec() . "<br />".
37 "getAudioChannels: " . $ffmpegInstance->getAudioChannels() . "<br />".
38 "hasAudio: " . $ffmpegInstance->hasAudio();
39 ?>

Comments

Login or Register to comment.


Embed Me!

Feel free to adjust iframe width and height according to your needs.

<iframe width="800px" 
        src="http://www.emoticode.net/embed/php/ffmpeg-example-script.html" 
        height="400px" 
        frameborder="0"> 
</iframe>

Here's how it will look like.