我已经下载了 Xuggler 并将 Jar 文件添加到 Eclipse 库中,我为 java 编写了一些代码来获取 flv 文件并将其转换为 mov:
public class Main {
public static void main(String[] args) {
IMediaReader reader = ToolFactory.makeReader("res/input.flv");
IMediaWriter writer = ToolFactory.makeWriter("res/output.mov", reader);
reader.addListener(writer);
while(reader.readPacket() == null);
}}
我的 flv 文件也在 eclipse 中名为 res 的文件夹下。
当我运行此代码时,我收到以下错误:
Exception in thread "main" java.lang.RuntimeException: could not open stream com.xuggle.xuggler.IStream@269225200[index:0;id:0;streamcoder:com.xuggle.xuggler.IStreamCoder@3536496[codec=com.xuggle.xuggler.ICodec@269351856[type=CODEC_TYPE_VIDEO;id=CODEC_ID_H264;name=libx264;];time base=1/15;frame rate=0/0;pixel type=YUV420P;width=235;height=217;];framerate:0/0;timebase:1/90000;direction:OUTBOUND;]: Operation not permitted
at com.xuggle.mediatool.MediaWriter.openStream(MediaWriter.java:1192)
at com.xuggle.mediatool.MediaWriter.getStream(MediaWriter.java:1052)
at com.xuggle.mediatool.MediaWriter.encodeVideo(MediaWriter.java:742)
at com.xuggle.mediatool.MediaWriter.encodeVideo(MediaWriter.java:783)
at com.xuggle.mediatool.MediaWriter.onVideoPicture(MediaWriter.java:1434)
at com.xuggle.mediatool.AMediaToolMixin.onVideoPicture(AMediaToolMixin.java:166)
at com.xuggle.mediatool.MediaReader.dispatchVideoPicture(MediaReader.java:610)
at com.xuggle.mediatool.MediaReader.decodeVideo(MediaReader.java:519)
at com.xuggle.mediatool.MediaReader.readPacket(MediaReader.java:475)
at Main.main(Main.java:12)
这些错误是什么意思,我该如何解决?