/**
* 获取视频时长
*
* @author zhy
* @param videoPath 视频文件存放路径
* @return
*/
public static long getVideoTime(String videoPath) {
File source = new File(videoPath);
long time = 0;
Encoder encoder = new Encoder();
try {
MultimediaInfo m = encoder.getInfo(source);
long ls = m.getDuration();
time = m.getDuration();
System.out.println("此视频时长为:"+ls/60000+"分"+(ls%60000)/1000+"秒!");
} catch (Exception e) {
e.printStackTrace();
}
return time;
}
获取视频时长
最新推荐文章于 2024-06-11 15:13:58 发布