我正在尝试使用libjitsi来传输某些音频,但是我无法使其正常工作。我使用的是Windows10。这是我所做的:
/lib/native
中的库添加到java.library.path
中。 AVTransmit2
上运行--local-port-base=5100 --remote-host=localhost --remote-port-base=5200
,而在AVReceive2
上运行--local-port-base=5200 --remote-host=localhost --remote-port-base=5100
。当我运行两个文件时,都会出现类似的错误。首先我看到
WARNING: Failed to initialize org.jitsi.impl.neomedia.device.DirectShowSystem
java.lang.reflect.UndeclaredThrowableException
at org.jitsi.impl.neomedia.device.DeviceSystem.invokeDeviceSystemInitialize(DeviceSystem.java:441)
...
at org.jitsi.service.libjitsi.LibJitsi.getMediaService(LibJitsi.java:124)
at org.jitsi.examples.AVTransmit2.start(AVTransmit2.java:104)
at org.jitsi.examples.AVTransmit2.main(AVTransmit2.java:359)
Caused by: java.lang.UnsatisfiedLinkError: org.jitsi.impl.neomedia.codec.FFmpeg.av_get_pix_fmt(Ljava/lang/String;)I
at org.jitsi.impl.neomedia.codec.FFmpeg.av_get_pix_fmt(Native Method)
...
,然后在我看到的日志中
WARNING: Failed to initialize org.jitsi.impl.neomedia.device.DirectShowSystem
java.lang.reflect.UndeclaredThrowableException
at org.jitsi.impl.neomedia.device.DeviceSystem.invokeDeviceSystemInitialize(DeviceSystem.java:441)
at org.jitsi.impl.neomedia.device.DeviceSystem.invokeDeviceSystemInitialize(DeviceSystem.java:348)
at org.jitsi.impl.neomedia.device.DeviceSystem.<init>(DeviceSystem.java:493)
at org.jitsi.impl.neomedia.device.DeviceSystem.<init>(DeviceSystem.java:475)
at org.jitsi.impl.neomedia.device.DirectShowSystem.<init>(DirectShowSystem.java:61)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.lang.Class.newInstance(Class.java:442)
at org.jitsi.impl.neomedia.device.DeviceSystem.initializeDeviceSystems(DeviceSystem.java:288)
at org.jitsi.impl.neomedia.device.DeviceSystem.initializeDeviceSystems(DeviceSystem.java:230)
at org.jitsi.impl.neomedia.MediaServiceImpl.getDevices(MediaServiceImpl.java:577)
at org.jitsi.impl.neomedia.MediaServiceImpl.getDefaultDevice(MediaServiceImpl.java:500)
at org.jitsi.examples.AVTransmit2.start(AVTransmit2.java:119)
at org.jitsi.examples.AVTransmit2.main(AVTransmit2.java:359)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.jitsi.impl.neomedia.jmfext.media.protocol.directshow.DataSource
at org.jitsi.impl.neomedia.device.DirectShowSystem.doInitialize(DirectShowSystem.java:97)
at org.jitsi.impl.neomedia.device.DeviceSystem.initialize(DeviceSystem.java:642)
at org.jitsi.impl.neomedia.device.DeviceSystem$1.run(DeviceSystem.java:393)
Exception in thread "main" java.lang.IllegalArgumentException: direction
at org.jitsi.service.neomedia.AbstractMediaStream.assertDirection(AbstractMediaStream.java:105)
at org.jitsi.impl.neomedia.MediaStreamImpl.setDirection(MediaStreamImpl.java:2831)
at org.jitsi.examples.AVTransmit2.start(AVTransmit2.java:128)
at org.jitsi.examples.AVTransmit2.main(AVTransmit2.java:359)
由于在未满足的链接错误中看到“ ffmpeg”,因此我尝试从https://ffmpeg.zeranoe.com/builds/win64/shared/ffmpeg-4.1-win64-shared.zip下载ffmpeg。我之所以选择“共享的”,是因为它具有将JNI接口链接到的DLL。我将ffmpeg安装的bin文件夹添加到java.library.path中,但没有任何乐趣-同样的错误。似乎他们的任何安装程序都没有“安装”任何东西-他们只是将文件解压缩到磁盘上。
从错误堆栈中,我猜测是由于某种原因我缺少了DirectShow所需的一些本机库,但我无法弄清楚它们应该是什么。
有人能够运行这些示例吗?我需要安装一些东西才能使其正常工作吗?
答案 0 :(得分:0)
显然,有些原因阻止了我尝试使用的每台笔记本电脑上的视频媒体流初始化。但是音频流很好。通过添加
if(mediaType != MediaType.AUDIO) continue;
在MediaType
循环内(仅使用AUDIO),我可以使示例工作。