在项目开发过程中,需要获取音视频文件时长。查询资料后发现 JAVE能够完美得到想要的结果,JAVE项目简介如下:
The JAVE (Java Audio Video Encoder) library is Java wrapper on the ffmpeg project. Developers can take take advantage of JAVE to transcode audio and video files from a format to another. In example you can transcode an AVI file to a MPEG one, you can change a DivX video stream into a (youtube like) Flash FLV one, you can convert a WAV audio file to a MP3 or a Ogg Vorbis one, you can separate and transcode audio and video tracks, you can resize videos, changing their sizes and proportions and so on. Many other formats, containers and operations are supported by JAVE.
总的来说JAVE不仅能够获取音视频文件时长,而且能够在代码中将音视频进行格式转换,可以说功能很强大了,我暂时只用到获取时长这一最简