Use fluent-ffmpeg to tell if a file is a video or audio

I am using node-fluent-ffmpeg module in NodeJS. It is very good that fluent-ffmpeg provides functions to get the metadata of a video and audio file. [][1] I have tried on Mac OS to use the "resolution" attribute in the metadata to tell if a file is audio only or video, i.e. if both resolution.w and resolution.h are 0, then this file is an audio. This work fine on Mac OS. But some strange things happened that this doesn't work on Windows platform (I have tried Windows 7 64bit and Windows 2008) using the latest ffmpeg. Even though I put a .mp3 file through fluent-ffmpeg,the result looks something like this: video: { container:'mp3', ... resolution: {w:300,h:300}, resolutionSquare: {w:300,h:300}, aspectString: '1:1', ... } audio: { codec:'mp3', bitrate:64, sample_rate:44100, stream:0, channels:1 } I am not why there is a "resolution" since it is a pure audio file. So is there any solid way to find out if the file is audio only or video from the metadata? Or should I use ffmpeg commandline to find it out? [1]:

以上就是Use fluent-ffmpeg to tell if a file is a video or audio的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » Node.js答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准