import it.sauronsoftware.jave.Encoder;
import it.sauronsoftware.jave.MultimediaInfo;
import java.io.File;
public class ReadVideo {
public static void main(String[] args){
File source = new File("E:\\测试视频\\R41.avi");
Encoder encoder = new Encoder();
try {
MultimediaInfo m = encoder.getInfo(source);
long ls = m.getDuration();
System.out.println(s/1000+"秒!");
} catch (Exception e) {
e.printStackTrace();
}
}
}
//转换时间格式
public static String formatDuring(long mss) {
// long days = mss / (1000 * 60 * 60 * 24);
// long hours = (mss % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60);
long minutes = (mss % (1000 * 60 * 60)) / (1000 * 60);
long seconds = (mss % (1000 * 60)) / 1000;
String tmp_seconds = "";
String tmp_minutes = "";
if(seconds<10){
tmp_seconds = "0"+seconds;
}else{
tmp_seconds = Long.toString(seconds);
}
if(minutes<10){
tmp_minutes = "0"+minutes;
}else{
tmp_minutes = Long.toString(minutes);
}
// return days + " days " + hours + " hours " + minutes + " minutes " + seconds + " seconds ";
return tmp_minutes+":"+tmp_seconds;
}
附件列表