Example #1
0
$extension = "ffmpeg";
$extension_soname = $extension . "." . PHP_SHLIB_SUFFIX;
$extension_fullname = PHP_EXTENSION_DIR . "/" . $extension_soname;
// load extension
if (!extension_loaded($extension)) {
    dl($extension_soname) or die("Can't load extension {$extension_fullname}\n");
}
if (php_sapi_name() != 'cli') {
    echo '<pre>';
}
printf("ffmpeg-php version string: %s\n", FFMPEG_PHP_VERSION_STRING);
printf("ffmpeg-php build date string: %s\n", FFMPEG_PHP_BUILD_DATE_STRING);
printf("libavcodec build number: %d\n", LIBAVCODEC_BUILD_NUMBER);
printf("libavcodec version number: %d\n", LIBAVCODEC_VERSION_NUMBER);
print_class_methods("ffmpeg_movie");
print_class_methods("ffmpeg_frame");
// get an array for movies from the test media directory
$movies = getDirFiles(dirname(__FILE__) . '/tests/test_media');
echo "--------------------\n\n";
foreach ($movies as $movie) {
    $mov = new ffmpeg_movie($movie);
    printf("file name = %s\n", $mov->getFileName());
    printf("duration = %s seconds\n", $mov->getDuration());
    printf("frame count = %s\n", $mov->getFrameCount());
    printf("frame rate = %0.3f fps\n", $mov->getFrameRate());
    printf("comment = %s\n", $mov->getComment());
    printf("title = %s\n", $mov->getTitle());
    printf("author = %s\n", $mov->getAuthor());
    printf("copyright = %s\n", $mov->getCopyright());
    printf("get bit rate = %d\n", $mov->getBitRate());
    printf("has audio = %s\n", $mov->hasAudio() == 0 ? 'No' : 'Yes');
if (php_sapi_name() != 'cgi') {
    echo '<pre>';
}
$ignore_demo_files = true;
$dir = dirname(dirname(dirname(dirname(__FILE__))));
require_once $dir . '/examples/example-config.php';
$tmp_dir = PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_BATH . 'tmp/';
// printf("ffmpeg-php version string: %s\n", FFMPEG_PHP_VERSION_STRING);
// printf("libavcodec build number: %d\n", LIBAVCODEC_BUILD_NUMBER);
// printf("libavcodec version number: %d\n", LIBAVCODEC_VERSION_NUMBER);
echo "--------------------";
print_class_methods("ffmpeg_movie");
echo "\n\n--------------------";
print_class_methods("ffmpeg_frame");
echo "\n\n--------------------";
print_class_methods("ffmpeg_animated_gif");
echo "\n\n--------------------\n";
// get an array for movies from the test media directory
$movies = getDirFiles($dir . '/examples/to-be-processed');
// print_r($movies);
foreach ($movies as $movie) {
    $mov = new PHPVideoToolkit_movie($movie, false, $tmp_dir);
    printf("file name = %s\n", $mov->getFileName());
    printf("duration = %s seconds\n", $mov->getDuration());
    printf("frame count = %s\n", $mov->getFrameCount());
    printf("frame rate = %0.3f fps\n", $mov->getFrameRate());
    printf("comment = %s\n", $mov->getComment());
    printf("title = %s\n", $mov->getTitle());
    printf("author = %s\n", $mov->getAuthor());
    printf("copyright = %s\n", $mov->getCopyright());
    printf("get bit rate = %d\n", $mov->getBitRate());