时间:2021-07-01 10:21:17 帮助过:36人阅读
工作用到获取视频时长,需要在windows下扩展ffmpeg
在网上找的全是支持32位的系统,我是64位win7的 php版本为5.2.4
下载32位下包http://download.csdn.net/detail/xiao_bai8/7027699,打开有avcodec-51.dll、avformat-51.dll、avutil-49.dll、pthreadGC2.dll、php_ffmpeg.dll
把php_ffmpeg.dll还是放到php/ext下
剩下的四个文件放到C:\Windows\SysWOW64下,之前是放到C:\Windows\System32,但是64位没反映
代码测试:
getDuration()."
" ."getFrameCount: " . $ffmpegInstance->getFrameCount()."
" ."getFrameRate: " . $ffmpegInstance->getFrameRate()."
" ."getFilename: " . $ffmpegInstance->getFilename()."
" ."getComment: " . $ffmpegInstance->getComment()."
" ."getTitle: " . $ffmpegInstance->getTitle()."
" ."getAuthor: " . $ffmpegInstance->getAuthor()."
" ."getCopyright: " . $ffmpegInstance->getCopyright()."
" ."getArtist: " . $ffmpegInstance->getArtist()."
" ."getGenre: " . $ffmpegInstance->getGenre()."
" ."getTrackNumber: " . $ffmpegInstance->getTrackNumber()."
" ."getYear: " . $ffmpegInstance->getYear()."
" ."getFrameHeight: " . $ffmpegInstance->getFrameHeight()."
" ."getFrameWidth: " . $ffmpegInstance->getFrameWidth()."
" ."getPixelFormat: " . $ffmpegInstance->getPixelFormat()."
" ."getBitRate: " . $ffmpegInstance->getBitRate()."
" ."getVideoBitRate: " . $ffmpegInstance->getVideoBitRate()."
" ."getAudioBitRate: " . $ffmpegInstance->getAudioBitRate()."
" ."getAudioSampleRate: " . $ffmpegInstance->getAudioSampleRate()."
" ."getVideoCodec: " . $ffmpegInstance->getVideoCodec()."
" ."getAudioCodec: " . $ffmpegInstance->getAudioCodec()."
" ."getAudioChannels: " . $ffmpegInstance->getAudioChannels()."
" ."hasAudio: " . $ffmpegInstance->hasAudio(); 7.执行后如果拿到视频的一些信息如下就表示环境配置成功了,那我们就可以开始开发我们的视频转换了。 执行结果: getDuration: 811.13336181641 //时长getFrameCount: 12167 //帧计数getFrameRate: 15 //帧速率getFilename: C:\wamp\www\top10.mp4 //文件名路径getComment: //评论getTitle:getAuthor:getCopyright:getArtist:getGenre:getTrackNumber: 0getYear: 0getFrameHeight: 240getFrameWidth: 320getPixelFormat: yuv420p //像素格式getBitRate: 269769 //比特率getVideoBitRate:getAudioBitRate:getAudioSampleRate: 48000getVideoCodec: mpeg4 //视频编解码器getAudioCodec: mpeg4aacgetAudioChannels: 2hasAudio: 1