使用vlcj将RTSP视频流接收到多个画布

时间:2016-02-17 08:45:25

标签: java video-streaming vlcj

我正在尝试使用Canvas从手机接收多个rtsp视频流到我的PC应用程序,

但我首先只测试了2个视频。 这是我现在使用的代码。

final String url = "rtsp://192.168.173.217:8085";
final String url2 = "rtsp://192.168.173.104:8086";

SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            //new MediaPlayer(filePath);
            MediaPlayerFactory mediaPlayerFactory = new MediaPlayerFactory();

            CanvasVideoSurface videoSurface = mediaPlayerFactory.newVideoSurface(canvas1);
            EmbeddedMediaPlayer mediaPlayer = mediaPlayerFactory.newEmbeddedMediaPlayer();
            mediaPlayer.setVideoSurface(videoSurface);

            CanvasVideoSurface videoSurface2 = mediaPlayerFactory.newVideoSurface(canvas2);
            EmbeddedMediaPlayer mediaPlayer2 = mediaPlayerFactory.newEmbeddedMediaPlayer();
            mediaPlayer2.setVideoSurface(videoSurface2);

            mediaPlayer2.playMedia(url2);
            mediaPlayer.playMedia(url);

        }
    });   

事情是,这适用于视频文件或单个rtsp流,但不适用于多个流。

它的作用就像所有流都包含在同一个画布后面跟着这些错误(好吧,只有其中一些)。

[h264 @ 1774e6e0] decode_slice_header error
[H264 Decoder @ 17df9720] invalid mixed IDR / non IDR frames cannot be decoded in slice multithreading mode
[h264 @ 1774e6e0] illegal memory management control operation 32

0 个答案:

没有答案