Ffmpeg

<?php 
$movefile = "./4.mp4"; 
$mov = new ffmpeg_movie($movefile); 
    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); 
        printf("get frame = %s\n", is_object($frame) ? 'true' : 'false'); 
        printf("  get frame number = %d\n", $mov->getFrameNumber()); 
        printf("  get frame width = %d\n", $frame->getWidth()); 
        printf("  get frame height = %d\n", $frame->getHeight()); 
    } 
    echo "\n--------------------\n\n"; 

 

posted on 2016-08-17 13:46  jzfan  阅读(168)  评论(0编辑  收藏  举报