Example #1
0
$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 ($mov->hasAudio()) {
        printf("get audio stream id= %s\n", $mov->getAudioStreamId());
        printf("get audio codec = %s\n", $mov->getAudioCodec());
        printf("get audio bit rate = %d\n", $mov->getAudioBitRate());
        printf("get audio sample rate = %d \n", $mov->getAudioSampleRate());
        printf("get audio channels = %s\n", $mov->getAudioChannels());
    }
    printf("has video = %s\n", $mov->hasVideo() == 0 ? 'No' : 'Yes');
    if ($mov->hasVideo()) {
        printf("frame height = %d pixels\n", $mov->getFrameHeight());
        printf("frame width = %d pixels\n", $mov->getFrameWidth());
        printf("get video stream id= %s\n", $mov->getVideoStreamId());
        printf("get video codec = %s\n", $mov->getVideoCodec());
        printf("get video bit rate = %d\n", $mov->getVideoBitRate());
        printf("get pixel format = %s\n", $mov->getPixelFormat());
        printf("get pixel aspect ratio = %s\n", $mov->getPixelAspectRatio());
        $frame = $mov->getFrame(10);
 $mov = new ffmpeg_movie($movie);
 echo '<table width="90%" class="hor-minimalist-a">';
 printf('<caption>Processing Test File: %s...</caption>', basename($mov->getFilename()));
 printf('<thead><tr><th width="150">Method</th><th>Result<br/></th></tr></thead>', $mov->getFileName());
 printf("<tr><td>file name:</td><td>%s<br/></td></tr>", $mov->getFileName());
 printf("<tr><td>duration</td><td>%s seconds<br/></td></tr>", $mov->getDuration());
 printf("<tr><td>frame count</td><td>%s<br/></td></tr>", $mov->getFrameCount());
 printf("<tr><td>frame rate</td><td>%0.3f fps<br/></td></tr>", $mov->getFrameRate());
 printf("<tr><td>comment</td><td>%s<br/></td></tr>", $mov->getComment());
 printf("<tr><td>title</td><td>%s<br/></td></tr>", $mov->getTitle());
 printf("<tr><td>author</td><td>%s<br/></td></tr>", $mov->getAuthor());
 printf("<tr><td>copyright</td><td>%s<br/></td></tr>", $mov->getCopyright());
 printf("<tr><td>get bit rate</td><td>%d<br/></td></tr>", $mov->getBitRate());
 printf("<tr><td>has audio</td><td>%s<br/></td></tr>", $mov->hasAudio() == 0 ? 'No' : 'Yes');
 if ($mov->hasAudio()) {
     printf("<tr><td>get audio stream id</td><td>%s<br/></td></tr>", $mov->getAudioStreamId());
     printf("<tr><td>get audio codec</td><td>%s<br/></td></tr>", $mov->getAudioCodec());
     printf("<tr><td>get audio bit rate</td><td>%d<br/></td></tr>", $mov->getAudioBitRate());
     printf("<tr><td>get audio sample rate</td><td>%d<br/></td></tr>", $mov->getAudioSampleRate());
     printf("<tr><td>get audio channels</td><td>%s<br/></td></tr>", $mov->getAudioChannels());
 }
 printf("<tr><td>has video</td><td>%s<br/></td></tr>", $mov->hasVideo() == 0 ? 'No' : 'Yes');
 if ($mov->hasVideo()) {
     printf("<tr><td>frame height</td><td>%d pixels<br/></td></tr>", $mov->getFrameHeight());
     printf("<tr><td>frame width</td><td>%d pixels<br/></td></tr>", $mov->getFrameWidth());
     printf("<tr><td>get video stream id</td><td>%s<br/></td></tr>", $mov->getVideoStreamId());
     printf("<tr><td>get video codec</td><td>%s<br/></td></tr>", $mov->getVideoCodec());
     printf("<tr><td>get video bit rate</td><td>%d<br/></td></tr>", $mov->getVideoBitRate());
     printf("<tr><td>get pixel format</td><td>%s<br/></td></tr>", $mov->getPixelFormat());
     printf("<tr><td>get pixel aspect ratio</td><td>%s<br/></td></tr>", $mov->getPixelAspectRatio());
     printf("<tr><td>get frame</td><td>%s<br/></td></tr>", is_object($mov->getFrame(10)) ? 'true' : 'false');