2012-05-25 187 views
4

我正在開發視頻聊天應用程序。我使用vlcj進行實時視頻流傳輸,但未能從其他系統捕獲視頻。使用vlcj通過http進行實況視頻流式傳輸

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(); 
} 

這是我的代碼,請幫我解決這個問題。

+0

改變了流線,和我的作品fineemediaPlayer.playMedia( 「DSHOW://」, \t \t \t \t「:SOUT =#{轉碼了vcodec = H264,VB = 800,FPS = 15,標度= 1,寬度= 1280,高度= 800,acodec = MP4A,​​AB = 128,信道= 2,採樣率= 44100}:{RTP SDP = rtsp://形式@ :5555 /演示}」, \t \t \t \t 「:無SOUT-RTP-SAP」, \t \t \t \t 「:無SOUT標準-SAP」, \t \t \t \t 「:SOUT所有」, \t \t \t \t 「:SOUT-保持」); –

+0

你會很好地把它作爲答案並接受它,以便其他遇到此問題的人可以快速找到解決方案! – berry120

回答

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"); 
相關問題