這是我正在開發的一個項目的一部分。我有兩個桌面Java應用程序,一個在服務器上運行(具有真實IP),另一個是客戶端。我只想從連接到服務器應用程序的網絡攝像頭流式傳輸實況視頻,然後在客戶端應用程序上播放它。我想從多臺攝像機進行流式傳輸。服務器和客戶端之間的實時視頻流 - 使用Java
我一直在尋找Xuggler,JMF,Red5,VLCj之間的天。我不能從我應該從哪裏開始,因爲我是在編程領域與媒體打交道的新手。
我應該從哪裏開始的任何想法?
在此先感謝
這是我正在開發的一個項目的一部分。我有兩個桌面Java應用程序,一個在服務器上運行(具有真實IP),另一個是客戶端。我只想從連接到服務器應用程序的網絡攝像頭流式傳輸實況視頻,然後在客戶端應用程序上播放它。我想從多臺攝像機進行流式傳輸。服務器和客戶端之間的實時視頻流 - 使用Java
我一直在尋找Xuggler,JMF,Red5,VLCj之間的天。我不能從我應該從哪裏開始,因爲我是在編程領域與媒體打交道的新手。
我應該從哪裏開始的任何想法?
在此先感謝
我建議你去與VLCJ,因爲除了視頻直播,你可以給你的應用VLC媒體播放器的所有功能。此外,它適用於Linux,Windows和Mac。如果您可以使用VLC直播您的網絡攝像頭,那麼您可以使用VLCJ做同樣的事情。
有關如何使用它的詳細信息,請參閱VLCJ wiki page。他們在wiki中提供了很多例子。這裏是使用VLCJ的Http Streaming的一個例子。從VLCJ的例子複製。
/*
* This file is part of VLCJ.
*
* VLCJ is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* VLCJ is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with VLCJ. If not, see <http://www.gnu.org/licenses/>.
*
* Copyright 2009, 2010, 2011 Caprica Software Limited.
*/
package uk.co.caprica.vlcj.test.streaming;
import uk.co.caprica.vlcj.player.MediaPlayerFactory;
import uk.co.caprica.vlcj.player.headless.HeadlessMediaPlayer;
import uk.co.caprica.vlcj.test.VlcjTest;
/**
* 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 StreamHttp extends VlcjTest {
public static void main(String[] args) throws Exception {
if(args.length != 1) {
System.out.println("Specify a single MRL to stream");
System.exit(1);
}
String media = args[0];
String options = formatHttpStream("127.0.0.1", 5555);
System.out.println("Streaming '" + media + "' to '" + options + "'");
MediaPlayerFactory mediaPlayerFactory = new MediaPlayerFactory(args);
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();
}
}
嘗試java綁定到gstreamer:http://code.google.com/p/gstreamer-java/ –