您的位置:首页 > 汽车 > 时评 > 东莞网页设计费用_百度一下首页_竞价托管怎么做_seo服务商

东莞网页设计费用_百度一下首页_竞价托管怎么做_seo服务商

2025/4/29 21:38:15 来源:https://blog.csdn.net/weixin_41018853/article/details/147581389  浏览:    关键词:东莞网页设计费用_百度一下首页_竞价托管怎么做_seo服务商
东莞网页设计费用_百度一下首页_竞价托管怎么做_seo服务商

下载

参考网址 

【收藏级教程】FFmpeg音视频处理宝典:从入门到精通的50个实用技巧_ffmpeg教程-CSDN博客

配置环境变量

验证

重启idea开发工具

springboot maven集成

<dependency><groupId>com.github.kokorin.jaffree</groupId><artifactId>jaffree</artifactId><version>2023.09.10</version>
</dependency>

视频转换同时获取视频大小和时长

package org.jeecg.common.util;import com.github.kokorin.jaffree.StreamType;
import com.github.kokorin.jaffree.ffmpeg.*;import javax.imageio.ImageIO;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.concurrent.atomic.AtomicLong;public class JaffreeVideoConverter {static final AtomicLong durationMillis = new AtomicLong();static final AtomicLong durationMillis2 = new AtomicLong();public static void main(String[] args) {// 输入和输出文件路径Path input = Paths.get("D:/input.wmv");Path outputss = Paths.get("D:/231311.mp4");// 调用FFmpeg进行视频格式转换FFmpegResult result = FFmpeg.atPath().addInput(UrlInput.fromPath(input)).addOutput(UrlOutput.toPath(outputss)).setProgressListener(new ProgressListener() {@Overridepublic void onProgress(FFmpegProgress progress) {durationMillis.set(progress.getTimeMillis());durationMillis2.set(progress.getSize());}}).execute();System.out.println("Exact duration: " + durationMillis.get() + " milliseconds");//视频时长System.out.println("Exact duration22: " + durationMillis2.get() + " milliseconds");//视频大小System.out.println("视频格式转换完成!");}
}

获取视频封面

package org.jeecg.common.util;import com.github.kokorin.jaffree.StreamType;
import com.github.kokorin.jaffree.ffmpeg.*;import javax.imageio.ImageIO;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.concurrent.atomic.AtomicLong;public class JaffreeVideoConverter {public static void main(String[] args) {// 输入和输出文件路径Path input = Paths.get("D:/input.wmv");Path outputs = Paths.get("D:/");FFmpegResult result = FFmpeg.atPath().addInput(UrlInput.fromPath(input)).addOutput(FrameOutput.withConsumer(new FrameConsumer() {private long num = 1;@Overridepublic void consumeStreams(List<Stream> streams) {// All stream type except video are disabled. just ignore}@Overridepublic void consume(Frame frame) {// End of Streamif (frame == null) {return;}try {String filename = "frame_" + num++ + ".png";Path output = outputs.resolve(filename);ImageIO.write(frame.getImage(), "png", output.toFile());} catch (Exception e) {e.printStackTrace();}}})//控制截多少张图,这里我只需要截取一张.setFrameCount(StreamType.VIDEO, 1l)//每十秒截取一张 从0开始.setFrameRate(0.1).disableStream(StreamType.AUDIO).disableStream(StreamType.SUBTITLE).disableStream(StreamType.DATA)).execute();}
}

除此之外,还可以合成视频,截取视频等功能

Jaffree项目地址

https://gitcode.com/gh_mirrors/ja/Jaffree

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com