J'essaye d'écrire une application de streaming vidéo http avec Java en utilisant la bibliothèque VLCJ mais j'ai un problème "votre entrée ne peut pas être ouverte".Vidéo http Streaming Java avec VLCJ - Votre entrée ne peut pas être ouverte
OS: Windows 10 x64
Mon code source: https://github.com/caprica/vlcj/blob/master/src/test/java/uk/co/caprica/vlcj/test/streaming/StreamHttp.java
import com.sun.jna.Native;
import com.sun.jna.NativeLibrary;
import uk.co.caprica.vlcj.binding.LibVlc;
import uk.co.caprica.vlcj.player.MediaPlayerFactory;
import uk.co.caprica.vlcj.player.headless.HeadlessMediaPlayer;
import uk.co.caprica.vlcj.runtime.RuntimeUtil;
import uk.co.caprica.vlcj.runtime.x.LibXUtil;
import java.io.File;
/**
* An example of how to stream a media file over HTTP.
* <p>
* The client specifies an MRL of <code>http://127.0.0.1:5555</code>
*/
public class VideoStream extends VlcjTest{
public static void main(String[] args) throws Exception {
System.setProperty("VLC_PLUGIN_PATH", "D:\\Program Files\\VideoLAN\\VLC\\plugins");
File vlcInstallPath = new File("D:\\Program Files\\VideoLAN\\VLC");
NativeLibrary.addSearchPath(
RuntimeUtil.getLibVlcLibraryName(), vlcInstallPath.getAbsolutePath());
Native.loadLibrary(RuntimeUtil.getLibVlcLibraryName(), LibVlc.class);
LibXUtil.initialise();
String media = "D://demo.mp4";
String options = formatHttpStream("127.0.0.1", 5555);
System.out.println("Streaming '" + media + "' to '" + options + "'");
MediaPlayerFactory mediaPlayerFactory = new MediaPlayerFactory();
HeadlessMediaPlayer mediaPlayer = mediaPlayerFactory.newHeadlessMediaPlayer();
mediaPlayer.playMedia(media, options);
// Don't exit
Thread.currentThread().join();
}
private static String formatHttpStream(String serverAddress, int serverPort) {
StringBuilder sb = new StringBuilder(60);
sb.append(":sout=#duplicate{dst=std{access=http,mux=ts,");
sb.append("dst=");
sb.append(serverAddress);
sb.append(':');
sb.append(serverPort);
sb.append("}}");
return sb.toString();
}
}
et résultat:
[000000001a948be0] access_output_http access out: Consider passing --http-host=IP on the command line instead.
[000000001aa2def0] core input error: open of `D://demo.mp4' failed
[000000001aa2def0] core input error: Your input can't be opened
[000000001aa2def0] core input error: VLC is unable to open the MRL 'D://demo.mp4'. Check the log for details.
'D' ne semble pas être un protocole d'accès [Media Resource Locator] correct (https://wiki.videolan.org/Media_resource_locator/). –
J'utilise ce fichier multimédia http://www.sample-videos.com/video/mp4/240/big_buck_bunny_240p_5mb.mp4 – mesutpiskin