我正在尝试运行 xuggler 的 InputOutputStreamHandler 示例。我正在尝试将视频转换为 FLV 并将生成的视频写入标准输出。这是源代码:
import java.io.IOException;
import java.io.OutputStream;
import com.xuggle.mediatool.IMediaReader;
import com.xuggle.mediatool.IMediaWriter;
import com.xuggle.mediatool.ToolFactory;
import com.xuggle.xuggler.io.InputOutputStreamHandler;
import com.xuggle.xuggler.io.XugglerIO;
public class Test {
public static void main(String[] args) throws IOException {
OutputStream outStream = System.out;
InputOutputStreamHandler handler = new InputOutputStreamHandler(outStream);
IMediaReader reader = ToolFactory.makeReader("myvideo.flv");
IMediaWriter writer = ToolFactory.makeWriter(XugglerIO.map(XugglerIO
.generateUniqueName(handler, ".flv"), handler), reader);
reader.addListener(writer);
while(reader.readPacket() == null);
}
}
我的问题是,当我尝试运行该程序时,它崩溃了,并且出现以下错误:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007f3ed28442e8, pid=9103, tid=139908218222336
#
# JRE version: 7.0_21-b11
# Java VM: Java HotSpot(TM) 64-Bit Server VM (23.21-b01 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C [xuggle5976644928112967115.tmp+0x2f02e8] avio_write+0x18
...
文件 hs_err_pid.log 提到:
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j com.xuggle.xuggler.XugglerJNI.IContainer_writeHeader(JLcom/xuggle/xuggler/IContainer;)I+0
j com.xuggle.xuggler.IContainer.writeHeader()I+5
j com.xuggle.mediatool.MediaWriter.getStream(I)Lcom/xuggle/xuggler/IStream;+222
j com.xuggle.mediatool.MediaWriter.encodeAudio(ILcom/xuggle/xuggler/IAudioSamples;)V+17
j com.xuggle.mediatool.MediaWriter.onAudioSamples(Lcom/xuggle/mediatool/event/IAudioSamplesEvent;)V+16
j com.xuggle.mediatool.AMediaToolMixin.onAudioSamples(Lcom/xuggle/mediatool/event/IAudioSamplesEvent;)V+31
j com.xuggle.mediatool.MediaReader.dispatchAudioSamples(ILcom/xuggle/xuggler/IAudioSamples;)V+14
j com.xuggle.mediatool.MediaReader.decodeAudio(Lcom/xuggle/xuggler/IStreamCoder;Lcom/xuggle/xuggler/IPacket;)V+91
j com.xuggle.mediatool.MediaReader.readPacket()Lcom/xuggle/xuggler/IError;+131
j Test.main([Ljava/lang/String;)V+45
v ~StubRoutines::call_stub
有谁知道我该如何绕过这个问题?
先感谢您!