我想将在线流保存到文件中,我在 java 中使用了 IMediaReader 和 IMediaWriter(在 PC 中),它可以正常读写,但是当我尝试在 android 中使用它时,会出现 ExceptionInInitializeError。这是我的代码
IMediaReader reader = ToolFactory.makeReader("rtsp://217.115.145.185:1935/live/mp4:alexlivestream_2");
IMediaWriter writer = ToolFactory.makeWriter("output.mp4", reader);
// add a debug listener to the writer to see media writer events
writer.addListener(ToolFactory.makeDebugListener());
reader.addListener(writer);
// read and decode packets from the source file and
// and dispatch decoded audio and video to the writer
int i=0;
while (i++<1000) {
System.out.println(i);
if (reader.readPacket() != null) {
break;
}
}
writer.close();
例外:
Exception Ljava/lang/ExceptionInInitializerError; thrown while initializing Lcom/xuggle/ferry/Ferry;
Exception Ljava/lang/ExceptionInInitializerError; thrown while initializing Lcom/xuggle/xuggler/XugglerJNI;
Exception Ljava/lang/ExceptionInInitializerError; thrown while initializing Lcom/xuggle/xuggler/IContainer;
FATAL EXCEPTION: main
java.lang.ExceptionInInitializerError
at com.xuggle.mediatool.MediaReader.<init>(MediaReader.java:137)
at com.xuggle.mediatool.ToolFactory.makeReader(ToolFactory.java:77)
at com.example.yeni.MainActivity.startMediaToolsConversion(MainActivity.java:84)
at com.example.yeni.MainActivity.onCreate(MainActivity.java:75)
at android.app.Activity.performCreate(Activity.java:5206)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1083)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2064)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
at android.app.ActivityThread.access$600(ActivityThread.java:140)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4898)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ExceptionInInitializerError
at com.xuggle.xuggler.IContainer.<clinit>(IContainer.java:1622)
... 18 more
Caused by: java.lang.ExceptionInInitializerError
at com.xuggle.xuggler.XugglerJNI.<clinit>(XugglerJNI.java:19)
... 19 more
Caused by: java.lang.ExceptionInInitializerError
at com.xuggle.ferry.Ferry.<clinit>(Ferry.java:25)
... 20 more
Caused by: java.lang.UnsatisfiedLinkError: Couldn't load xuggle: findLibrary returned null
at java.lang.Runtime.loadLibrary(Runtime.java:365)
at java.lang.System.loadLibrary(System.java:535)
at com.xuggle.ferry.JNILibraryLoader.loadLibrary0(JNILibraryLoader.java:268)
at com.xuggle.ferry.JNILibraryLoader.loadLibrary(JNILibraryLoader.java:171)
at com.xuggle.ferry.JNILibrary.load(JNILibrary.java:161)
at com.xuggle.ferry.FerryJNI.<clinit>(FerryJNI.java:16)
... 21 more
对不起英语不好:)