我想通过HTTP使用VLCJ流式传输屏幕。我可以使用网络摄像头进行视频流,但是当我尝试流式传输屏幕时,它会给我以下输出并停止应用程序:
Java结果:-1073741676
这是我正在使用的代码:
public class StreamHttp extends VlcjTest {
static MediaPlayerFactory mediaPlayerFactory;
public static void main(String[] args) throws Exception {
new NativeDiscovery().discover();
String options = formatHttpStream("127.0.0.1", 5555);
mediaPlayerFactory = new MediaPlayerFactory(args);
HeadlessMediaPlayer mediaPlayer = mediaPlayerFactory.newHeadlessMediaPlayer();
mediaPlayer.playMedia("screen://", options);
Thread.currentThread().join();
}
private static String formatHttpStream(String serverAddress, int serverPort) {
StringBuilder sb = new StringBuilder(60);
sb.append(":sout=#transcode{vcodec=mp4v,vb=800,scale=0,acodec=mpga,ab=128,channels=2,samplerate=44100}:duplicate{dst=std{access=http,mux=ts,");
sb.append("dst=");
sb.append(serverAddress);
sb.append(':');
sb.append(serverPort);
sb.append("}}");
return sb.toString();
}
}
Kinldy帮助!!
答案 0 :(得分:0)
好的,经过一番努力和搜索,我发现VLC播放器2.2.4存在问题,这是最新版本。我切换到VLC 2.1.3,一切都很完美。知道他们正在努力修复它。所以代码没有问题。