1 Star 0 Fork 0

ws/javm

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Test.java 1.18 KB
一键复制 编辑 原始数据 按行查看 历史
YCKJ2817 提交于 4年前 . video encode
package cn.angs;
import java.io.File;
import java.io.InputStream;
/**
* ClassName: Test.java
* Description:
*
* @author wangshun@cloudwalk.cn
* @version 1.0.0
* @date 2021/07/22 13:55
*/
public class Test {
public static void main(String[] args) throws Exception {
System.out.println(Test.class.getClassLoader().getResource(""));
File source = new File("C:\\Users\\YCKJ2817\\Desktop\\测试\\123.flv");
File target = new File("C:\\Users\\YCKJ2817\\Desktop\\测试\\1234.mp4");
Encoder encoder = new Encoder();
MultimediaInfo info = null;
try {
info = encoder.getInfo(source);
} catch (EncoderException e) {
e.printStackTrace();
}
System.out.println(info.getFormat());
try {
VideoAttributes video = new VideoAttributes();
video.setCodec("libx264");
EncodingAttributes attrs = new EncodingAttributes();
attrs.setFormat("mp4");
attrs.setVideoAttributes(video);
encoder.encode(source, target, attrs);
} catch (IllegalArgumentException | EncoderException e) {
e.printStackTrace();
}
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ws410/javm.git
git@gitee.com:ws410/javm.git
ws410
javm
javm
master

搜索帮助