PHP Classes
elePHPant
Icontem

File: examples/extract-information-from-media.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Oliver Lillie  >  PHP Video Toolkit  >  examples/extract-information-from-media.php  >  Download  
File: examples/extract-information-from-media.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Video Toolkit
Manipulate and convert videos with ffmpeg program
Author: By
Last change:
Date: 0 years ago
Size: 1,487 bytes
 

Contents

Class file image Download
<?php

   
include_once './includes/bootstrap.php';
   
    foreach (array(
       
$example_video_path => '\PHPVideoToolkit\Video',
       
$example_audio_path => '\PHPVideoToolkit\Audio',
    ) as
$path => $class)
    {
        try
        {
           
$phpvideotoolkit_media = new $class($path, $config);
           
$output = $phpvideotoolkit_media->read();
       
            echo
'<hr /><h1>Resulting Output for '.pathinfo($path, PATHINFO_BASENAME).'</h1>';
            \
PHPVideoToolkit\Trace::vars($output);

        }
        catch(\
PHPVideoToolkit\FfmpegProcessOutputException $e)
        {
            echo
'<h1>Error</h1>';
            \
PHPVideoToolkit\Trace::vars($e);

           
$process = $phpvideotoolkit_media->getProcess();
            if(
$process->isCompleted())
            {
                echo
'<hr /><h2>Executed Command</h2>';
                \
PHPVideoToolkit\Trace::vars($process->getExecutedCommand());
                echo
'<hr /><h2>FFmpeg Process Messages</h2>';
                \
PHPVideoToolkit\Trace::vars($process->getMessages());
                echo
'<hr /><h2>Buffer Output</h2>';
                \
PHPVideoToolkit\Trace::vars($process->getBuffer(true));
            }
        }
        catch(\
PHPVideoToolkit\Exception $e)
        {
            echo
'<h1>Error</h1>';
            \
PHPVideoToolkit\Trace::vars($e->getMessage());
            echo
'<h2>\PHPVideoToolkit\Exception</h2>';
            \
PHPVideoToolkit\Trace::vars($e);
        }
    }