4

我正在使用 64 位操作系统 Windows 7,并且我有 32 位 VLC 版本 1.1.8。

我已经添加了这些库 jna.jar platform.jar vlcj-1.1.5.1.jar

我无法使用 jVlc 进行流式传输

public class HelloVLC {

/**
 * @param args
 * @throws IOException 
 */
public static void main(String[] args) throws IOException {
    // TODO Auto-generated method stub

    System.out.println( WindowsRuntimeUtil.getVlcInstallDir());
      NativeLibrary.addSearchPath("libvlc", "C:\\Program Files (x86)\\VideoLAN\\VLC");
      String media = "dshow://";
     String[] options = {" :dshow-vdev=Integrated Webcam :dshow-adev=  :dshow-caching=200", ":sout = #transcode{vcodec=theo,vb=800,scale=0.25,acodec=vorb,ab=128,channels=2,samplerate=44100}:display :no-sout-rtp-sap :no-sout-standard-sap :ttl=1 :sout-keep"};
        System.out.println("Streaming '" + media + "' to '" + options + "'");

        MediaPlayerFactory mediaPlayerFactory = new MediaPlayerFactory();
        final HeadlessMediaPlayer mediaPlayer = mediaPlayerFactory.newMediaPlayer();
        mediaPlayer.playMedia(media, options);
}

}

我收到错误Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'libvlc': The specified module could not be found.

请帮忙。有没有办法让这个代码在 64 位操作系统中工作????

4

3 回答 3

6

你试过用 32 位 JVM 运行它吗?

于 2011-12-22T20:03:47.467 回答
6

如果您使用的是 Windows 7,则在您的 vlc 安装中搜索文件 libvlc.dll 和 libvlccore.dll 文件,并将它们的路径添加到您在
NativeLibrary.addSearchPath() 中编写的代码中还添加...

在我的情况下,这对我有用 Windows 7。

 NativeLibrary.addSearchPath(
                RuntimeUtil.getLibVlcLibraryName(), ""c:/Program Files/VideoLAN/VLC/");
        Native.loadLibrary(RuntimeUtil.getLibVlcLibraryName(), LibVlc.class);
        LibXUtil.initialise();
于 2012-06-05T04:53:46.767 回答
1

VLCj 带有自动发现方法,独立于操作系统,将相关路径添加到 JNA:s 搜索路径:

 NativeDiscovery nd = new NativeDiscovery();
 if (!nd.discover()) {
     System.out.println("VLC not found");
     System.exit(-1);
 }   
 String vlcLibName = RuntimeUtil.getLibVlcName();
 String vlcLibCoreName = RuntimeUtil.getLibVlcCoreName();
 Native.loadLibrary(vlcLibName, LibVlc.class);

...等有关如何加载 VLC 本机的好教程,请参阅 http://capricasoftware.co.uk/#/projects/vlcj/tutorial/first-steps (另请参阅该教程中的前面步骤)!

于 2016-10-27T10:26:15.983 回答