1.pom添加:

<dependency><groupId>ws.schild</groupId><artifactId>jave-core</artifactId><version>3.0.1</version>
</dependency>
<dependency><groupId>ws.schild</groupId><artifactId>jave-nativebin-linux64</artifactId><version>3.0.1</version>
</dependency>

2.新建类:

package com.api.ynlc.util;import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ws.schild.jave.*;
import ws.schild.jave.encode.AudioAttributes;
import ws.schild.jave.encode.EncodingAttributes;
import ws.schild.jave.encode.VideoAttributes;import java.io.File;
import java.util.Date;/*** @Auther: liyl* @Date: 2021/9/16 10:35* @Description:*/
public class VideoChangeUtil {private static final Logger logger = LoggerFactory.getLogger(com.api.ynlc.util.VideoChangeUtil.class);public static boolean AviToMp4(String oldPath,String newPath) {
//    File source = new File("D:\\temp\\1.avi");
//     File target = new File("D:\\file\\1.mp4");File source = new File(oldPath);File target = new File(newPath);logger.info("转换后的路径:"+newPath);AudioAttributes audio = new AudioAttributes();//音频编码格式audio.setCodec("libmp3lame");audio.setBitRate(new Integer(800000));audio.setChannels(new Integer(1));VideoAttributes video = new VideoAttributes();//视频编码格式video.setCodec("libx264");video.setBitRate(new Integer(6000000));//数字设置小了,视频会卡顿video.setFrameRate(new Integer(15));EncodingAttributes attrs = new EncodingAttributes();attrs.setAudioAttributes(audio);attrs.setVideoAttributes(video);Encoder encoder = new Encoder();MultimediaObject multimediaObject = new MultimediaObject(source);try {logger.info("avi转MP4 --- 转换开始:"+new Date());encoder.encode(multimediaObject, target, attrs);logger.info("avi转MP4 --- 转换结束:"+new Date());return true;} catch (IllegalArgumentException e) {// TODO Auto-generated catch blocke.printStackTrace();} catch (InputFormatException e) {// TODO Auto-generated catch blocke.printStackTrace();} catch (EncoderException e) {// TODO Auto-generated catch blocke.printStackTrace();}return false;}
}

spring boot Java 视频转换:avi转mp4相关推荐

  1. java 视频转换 avi 转 MP4

    添加jar 包 <dependency><groupId>ws.schild</groupId><artifactId>jave-core</ar ...

  2. Java视频格式转换---avi转MP4(h264编码格式)

    Java视频格式转换---avi转MP4(h264编码格式的MP4视频在网页播放兼容性更好--试过其它的编码格式,没找到能在网页上直接播放的) 资源借鉴处 需要添加到pom.xml的包 java代码 ...

  3. openshift k8s_带有DIY的Openshift上的Spring Boot / Java 8 / Tomcat 8

    openshift k8s DIY盒带是一种实验性盒带,提供了一种在OpenShift上测试不受支持的语言的方法. 它提供了最小限度的自由形式的支架,将墨盒的所有细节留给了应用程序开发人员 . 这篇博 ...

  4. 带有DIY的Openshift上的Spring Boot / Java 8 / Tomcat 8

    DIY墨盒是一种实验性墨盒,它提供了一种在OpenShift上测试不受支持的语言的方法. 它提供了最小限度的自由形式的支架,将墨盒的所有细节留给了应用程序开发人员 . 这篇博客文章说明了结合了Post ...

  5. Spring boot +java.awt.HeadlessException: null异常处理

    Spring boot +java.awt.HeadlessException: null异常处理 参考文章: (1)Spring boot +java.awt.HeadlessException: ...

  6. Spring Boot java.sql.SQLSyntaxErrorException: Table ‘mydb.table_name‘ doesn‘t exist

    我是强哥,一个在互联网苟且的男人 Spring Boot java.sql.SQLSyntaxErrorException: Table 'mydb.table_name' doesn't exist ...

  7. Spring Boot Shiro视频 - 身份认证准备工作

    [视频 & 交流平台] à SpringBoot视频 http://study.163.com/course/introduction.htm?courseId=1004329008& ...

  8. Java 视频转换h265、h264、mkv、mp4

    Java视频抽帧 [1. h264视频抽帧,支持windows](https://blog.csdn.net/qq_40985985/article/details/111240098) [2. h2 ...

  9. avi格式视频转换高清mp4的方法

    AVI英文全称为Audio Video Interleaved,即音频视频交错格式,AVI信息主要应用在多媒体光盘上,用来保存电视.电影等各种影像信息. 优点:跨平台使用 缺点:文件的体积(占用内存) ...

最新文章

  1. 英特尔cpu发布时间表_英特尔第11代桌面CPU将会支持PCIe4.0,Z490主板或可支持PCIe4.0...
  2. R语言dplyr包使用mutate函数生成新的数据列(不改变原数据列)实战
  3. Android handler Thread 修改UI Demo
  4. 使用SoapUI 测试Web Service
  5. 第十六天:9.1规划人力资源管理。
  6. 好的MongoDB中文文档
  7. 人工智能的突破需要颠覆图灵机吗?
  8. 前端学习(2504):vue指令v-for key
  9. 查看python版本命令
  10. ssm把后端数据传到前端_前端传数据到后台分别JSON和STRING接收 AJAX SPRINGBOOT ssm
  11. vmware克隆主机
  12. F5和nginx配合转发前端请求
  13. lightoj1234 打表技巧:分块打表
  14. linux安装yum
  15. excel换行快捷键_13个excel快捷键,学会他们,让你的1秒钟,抵得上同事的5分钟...
  16. shell 小米system锁adb_小米Max刷机及ADB操作
  17. Python爬网易云音乐的那些事
  18. 使用Scrapy框架爬取58同城的出租房信息
  19. python 获取节假日,二十四节气,中国农历,星次、每日凶煞、每日值神、农历建除十二神、农历每日宜忌、彭祖百忌、每日五行、二十八星宿、天干地支、农历生辰八字、时辰凶吉等
  20. 关于java 操作word的几种方式

热门文章

  1. 计算机专业本科考教资可以考哪些,高中教师资格证计算机专业考什么内容
  2. ssh秘钥远程登录服务器
  3. 只要愿意改变,什么时候都不太晚。。。。。
  4. 计算机音乐谱夜空中最亮的星歌词,夜空中最亮的星歌谱及歌词
  5. PM成长日记第三话-那些年我们一起做过的项目
  6. RFID技术在图书管理应用中的优势
  7. Linux网络编程——网络协议入门
  8. 三维模型的简化算法研究(任务书+lunwen+外文翻译+源码+查重报告)
  9. Spring入门须知
  10. error RC1015: cannot open include file 'sal.h'.