I am trying to use libjitsi to stream some audio, but I can't get it to work. I'm on Windows 10. Here's what I've done:
- Clone https://github.com/jitsi/libjitsi.git
- Import into Eclipse as a Maven project. Everything compiles fine.
- I eventually realized (by looking at the Ant buildfile) that I needed some native libs, so I added the libs in
/lib/native
to thejava.library.path
. - I am running
AVTransmit2
with--local-port-base=5100 --remote-host=localhost --remote-port-base=5200
andAVReceive2
with--local-port-base=5200 --remote-host=localhost --remote-port-base=5100
.
When I run either file, I get a similar error. First I see
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)
...
and then later in the logs I see
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)
Since I saw “ffmpeg” in the unsatisfied link error, I tried downloading ffmpeg from https://ffmpeg.zeranoe.com/builds/win64/shared/ffmpeg-4.1-win64-shared.zip. I chose the “shared” one because it has DLLs that I thought were needed to link the JNI interfaces to. I added the bin folder of the ffmpeg installtion to the java.library.path, but no joy - same error. It doesn't seem that any of their installers "install" anything - they just unzip files to the disk.
From the error stack, I’m guessing that somehow I’m missing some native libraries that are needed for DirectShow, but I cannot figure out what they should be.
Has anyone been able to get those examples to run? Is there something I need to install to get it working?