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.
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:
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?
以上就是Use fluent-ffmpeg to tell if a file is a video or audio的详细内容，更多请关注web前端其它相关文章！