java获取音频时长 大小

jave1.0.3

maven依赖代码

    <dependency>
        <groupId>com.github.dadiyang</groupId>
        <artifactId>jave</artifactId>
        <version>1.0.3</version>
    </dependency>

来自阿里云maven仓库
https://maven.aliyun.com/


package com.jave;
 
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();
                int second = ls \ 1000;
                System.out.println("此视频时长为:" + second + "秒!");
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

作者:武陵半仙
来源:CSDN
原文:https://blog.csdn.net/xie_sining/article/details/79643152
版权声明:本文为博主原创文章,转载请附上博文链接!

上一篇:编译opencv时报错ant:jave not found


下一篇:支付宝安全实验室发现3款恶意库,提醒开发者擦亮眼