我正在尝试将SWF转换为其他视频格式。目前我正在使用JAVAE(Java 音频视频编码器)。在它的文档中说它支持 SWF 编码和解码,但我不知道要使用哪个编解码器。我尝试过使用不同的编解码器,下面是我的 Java 代码,但它会引发以下异常。请让我知道我做错了什么。
我想将 swf 转换为 flv 或任何其他格式
Exception in thread "main" it.sauronsoftware.jave.InputFormatException: I/O error occured
at it.sauronsoftware.jave.Encoder.parseMultimediaInfo(Encoder.java:532)
at it.sauronsoftware.jave.Encoder.encode(Encoder.java:840)
at it.sauronsoftware.jave.Encoder.encode(Encoder.java:713)
at com.jave.converter.JAVEConverter.main(JAVEConverter.java:33)
代码:
package com.jave.converter;
import it.sauronsoftware.jave.AudioAttributes;
import it.sauronsoftware.jave.Encoder;
import it.sauronsoftware.jave.EncodingAttributes;
import it.sauronsoftware.jave.VideoAttributes;
import it.sauronsoftware.jave.VideoSize;
import java.io.File;
public class JAVEConverter {
public static void main(String... strings) throws Exception {
File source = new File("C:/Users/AZ/Desktop/swf/2.swf");
File target = new File("target.flv");
AudioAttributes audio = new AudioAttributes();
audio.setCodec("libmp3lame");
audio.setBitRate(new Integer(64000));
audio.setChannels(new Integer(1));
audio.setSamplingRate(new Integer(22050));
VideoAttributes video = new VideoAttributes();
video.setCodec("flv");
video.setBitRate(new Integer(160000));
video.setFrameRate(new Integer(15));
video.setSize(new VideoSize(400, 300));
EncodingAttributes attrs = new EncodingAttributes();
attrs.setFormat("flv");
attrs.setAudioAttributes(audio);
attrs.setVideoAttributes(video);
Encoder encoder = new Encoder();
System.out.println(encoder.getSupportedDecodingFormats());
System.out.println(encoder.getSupportedEncodingFormats());
encoder.encode(source, target, attrs);
}
}
更新 附加图像,其中将swf显示为支持的格式。