使用vlcj通过http直播视频

时间:2012-05-25 09:19:26

标签: video-streaming live-streaming vlcj

我正在开发视频聊天应用程序。我使用vlcj进行实时视频流,但未能从其他系统捕获视频。

public static void main(String[] args) throws Exception 
{
     NativeLibrary.addSearchPath("libvlc", "C:\\Program Files\\VideoLAN\\VLC");

     String media = "dshow://"; 
     String[] options = {" :dshow-vdev=CyberLink Webcam Splitter :dshow-adev=Microphone (Realtek High Defini  :live-caching=300", ":sout = #transcode{vcodec=h264,vb=800,fps=15,scale=1,width=1280,height=800,acodec=mp4a,ab=128,channels=2,samplerate=44100}:http{dst=:8080/a.ogg} :sout-keep"};

     System.out.println("Streaming '" + media + "' to '" + options + "'"); 

     MediaPlayerFactory mediaPlayerFactory = new MediaPlayerFactory(options); 
     HeadlessMediaPlayer mediaPlayer = mediaPlayerFactory.newMediaPlayer(); 
     mediaPlayer.playMedia(media, options);
     new PlayStream().play();

     // Don't exit
     Thread.currentThread().join();
}

这是我的代码,请帮助我克服这个问题。

1 个答案:

答案 0 :(得分:1)

更改了流媒体字符串,我工作正常

mediaPlayer.playMedia("dshow://", ":sout=#transcode{vcodec=h264,vb=800,fps=15,scale=1,width=1280,height=800,acod‌​ec=mp4a,ab=128,channels=2,samplerate=44100}:rtp{sdp=rtsp://@:5555/demo}", ":no-sout-rtp-sap", ":no-sout-standard-sap", ":sout-all", ":sout-keep");