问题
I am using 64 bit OS Windows 7 and i have 32 bit VLC versioned 1.1.8.
I have added these libraries
jna.jar
platform.jar
vlcj-1.1.5.1.jar
I am not able to stream using 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);
}
}
I am getting the error Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'libvlc': The specified module could not be found.
Kindly help. Is there any way to get this code work in 64 bit OS????
回答1:
have you tried running it with a 32-bit JVM?
回答2:
if you are using windows 7 then search for a file libvlc.dll and libvlccore.dll files in to your vlc installation and add their path to code that you've written in
NativeLibrary.addSearchPath() also add...
this worked me in my case windows 7.
NativeLibrary.addSearchPath(
RuntimeUtil.getLibVlcLibraryName(), ""c:/Program Files/VideoLAN/VLC/");
Native.loadLibrary(RuntimeUtil.getLibVlcLibraryName(), LibVlc.class);
LibXUtil.initialise();
回答3:
VLCj comes with automagic discovery methods, os-independent, that adds the relevent path to JNA:s search path:
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);
...etc for a good tutorial on how to load the VLC natives, see http://capricasoftware.co.uk/#/projects/vlcj/tutorial/first-steps (See also the previous steps in that tutorial)!
来源:https://stackoverflow.com/questions/8608117/vlcj-unable-to-load-library-libvlc-in-64bit-os