jave2 github 地址 https://github.com/a-schild/jave2
<dependency>
<groupId>ws.schild</groupId>
<artifactId>jave-all-deps</artifactId>
<version>2.6.0</version>
</dependency>
File source = new File("源视频路径");
File target = new File("转换后视频存储路径");
AudioAttributes audio = new AudioAttributes();
audio.setCodec("aac");
VideoAttributes video = new VideoAttributes();
video.setCodec("h264");
video.setBitRate(new Integer(2325 * 1024));
EncodingAttributes attrs = new EncodingAttributes();
attrs.setFormat("mp4");
attrs.setAudioAttributes(audio);
attrs.setVideoAttributes(video);
Encoder encoder = new Encoder();
encoder.encode(new MultimediaObject(source), target, attrs);