vlc-android-sdk - 无法查看 RTSP 实时视频

     2023-03-12     5

关键词:

【中文标题】vlc-android-sdk - 无法查看 RTSP 实时视频【英文标题】:vlc-android-sdk - cannot view RTSP live video 【发布时间】:2016-01-06 12:33:16 【问题描述】:

我一直在开发一个通过 RTSP 显示实时流媒体视频的 Android 应用程序。 假设我有一个运行良好的 RTSP 服务器,它可以传递 h264 数据包,并且要查看我们应该连接到 rtsp://1.2.3.4:5555/stream

的流

所以我尝试使用本机 MediaPlayer\VideoView,但没有运气(视频在播放 2-3 秒后卡住,所以我加载了 mrmaffen 的 vlc-android-sdk(可以找到 here)并使用以下代码:

            ArrayList<String> options = new ArrayList<String>();
            options.add("--no-drop-late-frames");
            options.add("--no-skip-frames");
            options.add("-vvv");
            videoVlc = new LibVLC(options);

            newVideoMediaPlayer = new org.videolan.libvlc.MediaPlayer(videoVlc);
            final IVLCVout vOut = newVideoMediaPlayer.getVLCVout();
            vOut.addCallback(this);
            vOut.setVideoView(videoView); //videoView is a pre-defined view which is part of the layout
            vOut.attachViews();
            newVideoMediaPlayer.setEventListener(this);

            Media videoMedia = new Media (videoVlc, Uri.parse(mVideoPath));
            newVideoMediaPlayer.setMedia(videoMedia);
            newVideoMediaPlayer.play();

问题是我看到一个空白屏幕。

请记住,当我只放置带有音频流的 RTSP 链接时,它可以正常工作。

是否有人熟悉此 sdk 并对此问题有所了解? 提前致谢

【问题讨论】:

你用vlc-android-sdk解决了这个问题吗? 【参考方案1】:

尝试添加此选项:

--rtsp-tcp

【讨论】:

谢谢,成功了!即使是来自 Google Play 的 VLC for Android 也无法播放某些流(因为它没有此选项)。在代码中:options.add("--rtsp-tcp");新的 LibVLC(上下文,选项);【参考方案2】:

我使用以下代码播放 rtsp 流

try 
        Uri rtspUri=Uri.parse("rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov");


        final MediaWrapper mw = new MediaWrapper(rtspUri);
        mw.removeFlags(MediaWrapper.MEDIA_FORCE_AUDIO);
        mw.addFlags(MediaWrapper.MEDIA_VIDEO);

        MediaWrapperListPlayer.getInstance().getMediaList().add(mw);

        VLCInstance.getMainMediaPlayer().setEventListener(this);
    VLCInstance.get().setOnHardwareAccelerationError(this);


    final IVLCVout vlcVout = VLCInstance.getMainMediaPlayer().getVLCVout();
    vlcVout.addCallback(this);
    vlcVout.setVideoView(mSurfaceView);
    vlcVout.attachViews();
    final SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this);
    final String aout = VLCOptions.getAout(pref);
    VLCInstance.getMainMediaPlayer().setAudioOutput(aout);
    MediaWrapperListPlayer.getInstance().playIndex(this, 0);

     catch (Exception e) 
        Log.e(TAG, e.toString());
    

当您获得播放事件时,您需要启用视频轨道。

private void onPlaying() 
    stopLoadingAnimation();
    VLCInstance.getMainMediaPlayer().setVideoTrackEnabled(true);

这可能对你有帮助

【讨论】:

访问限制:由于对所需库 ..\jre\lib\rt.jar 的限制,无法访问

】访问限制:由于对所需库..\\\\jre\\\\lib\\\\rt.jar的限制,无法访问【英文标题】:Accessrestriction:Isnotaccessibleduetorestrictiononrequiredlibrary..\\jre\\lib\\rt.jar访问限制:由于对所需库..\\jre\\lib\\rt.jar的限制,无法访问【发布时间】:2012-03-0... 查看详情

[分享]rt7lite精简后无法封装解决办法

eagleonly 发表于2016-6-911:00:01 https://www.itsk.com/forum.php?mod=viewthread&tid=368090&highlight=%BE%AB%BC%F2经过三天多十几次失败,终于找到了RT7LITE的毛病!它一打开系统就生成了这些影响封装的东东,现在找到它,并消灭了!用RT7L... 查看详情

解决eclipse调试jdk源码无法查看变量值

问题研究JDK源码的同学应该知道,在debug的时候是无法看源码中变量的值的,为什么呢?因为在JDK中,sun对rt.jar中的类编译时,去除了调试信息。那么是否有解决办法呢?答案是肯定的。解决方案1.在你的D:盘新建jdk... 查看详情

rt1052学习笔记-flexspi启动

...些,看到以下的内容,转载,如果后续有需要查看的可以查看RT1052学习笔记(1)-FlexSPI启动https://blog.csdn.net/weixin_42264572/artic 查看详情

rt-thread判断线程栈使用大小(代码片段)

...大会导致其它程序不够用,设置的过小则会导致程序无法顺利运行。方法一般的方法为:设置栈大小为2048通过命令窗口list_thread命令查看线程最大空间用量让后在对线程栈空间进行调节,一般栈空间最大利用率在70... 查看详情

rt-thread判断线程栈使用大小(代码片段)

...大会导致其它程序不够用,设置的过小则会导致程序无法顺利运行。方法一般的方法为:设置栈大小为2048通过命令窗口list_thread命令查看线程最大空间用量让后在对线程栈空间进行调节,一般栈空间最大利用率在70... 查看详情

钢筋 ./bin/sp 重启报告 'cannot load',asn1rt_nif,get_files 并且无法启动

】钢筋./bin/sp重启报告\\\'cannotload\\\',asn1rt_nif,get_files并且无法启动【英文标题】:Rebar./bin/sprestartreport\'cannotload\',asn1rt_nif,get_filesandcannotstart钢筋./bin/sp重启报告\'cannotload\',asn1rt_nif,get_files并且无法启动【发布时间】:2015-12-0203:34: 查看详情

rt-thread判断线程栈使用大小(代码片段)

...大会导致其它程序不够用,设置的过小则会导致程序无法顺利运行。方法一般的方法为:设置栈大小为2048通过命令窗口list_thread命令查看线程最大空间用量让后在对线程栈空间进行调节,一般栈空间最大利用率在70... 查看详情

centoslinux编译安装ralink无线网卡驱动出现错误,iinstall:无法获取"rt3090sta.ko"的文件状态(stat):

解压后进入该目录,执行.makeinstall出现:install:无法获取"rt3090sta.ko"的文件状态(stat):没有那个文件或目录make[1]:***[install]错误1make[1]:Leavingdirectory`/home/drz/下载/20101216_RT3090_LinuxSTA_V2.4.0.4_WiFiBTCombo_DPO/os/linux'make:***[install]错... 查看详情

ant自动编译javaproject时无法找到rt.jar的处理方法

最近在使用Ant自动化编译打包一个Java项目,执行时总是报有class找不到:  [javac]Compiling46sourcefilesto/A/B/C/D/build/staging/bin  [javac].../ChangePassWordTool.java:5: packagecom.sun.org.apache.xml.internal.security 查看详情

无法遍历字典数组中的数组

】无法遍历字典数组中的数组【英文标题】:Cannotiteratethrougharrayinsidearrayofdictionaries【发布时间】:2020-07-1322:11:44【问题描述】:我无法将响应快速解析为可行的对象。基本上,这是我得到的响应(用于查看目的的简化数据)"[\\... 查看详情

.NET 与 Windows RT 蓝牙 LE API - 重新启动 Windows 后无法读取或写入设备

】.NET与WindowsRT蓝牙LEAPI-重新启动Windows后无法读取或写入设备【英文标题】:.NETwithWindowsRTBluetoothLEAPI-cannotreadorwritedeviceafterrestartingWindows【发布时间】:2017-04-0509:45:46【问题描述】:我一直在为Windows8.1及更高版本使用低功耗蓝牙... 查看详情

rt3070驱动异常问题

新买的Wi-Fi网卡插在板子上,不能用。dmesg查看,看到下面的内容。[9.501098]phy0->rt2x00lib_request_firmware:Error-FailedtorequestFirmware.[10.092985]phy0->rt2x00lib_request_firmware:Error-FailedtorequestFirmware.[10.093877] 查看详情

授予 rt.jar 权限

...文件,通常不允许从任何地方读取...但这意味着rt.jar本身无法在需要时从文件中读取,这很糟糕。所以我添加了以下规则:grantcodeBase"file:$java.home/lib/rt.jar 查看详情

华硕ac68u已连接但无法上网?

...器的管理页面,查看一下联网状态是什么。出现连接但是无法上网,一般是上网账号、密码设置错误或者上网方式选择错误,另外也有可能是网线及电脑网卡的驱动及电脑本地连接配置的问题。 查看详情

ant自动编译javaproject时无法找到rt.jar的处理方法

最近在使用Ant自动化编译打包一个Java项目,执行时总是报有class找不到:  [javac]Compiling46sourcefilesto/A/B/C/D/build/staging/bin  [javac].../ChangePassWordTool.java:5: packagecom.sun.org.apache.xml.internal.security.utilsdoesnotexist  [javac]importcom.sun.... 查看详情

Django 1.1 TemplateSyntaxError - 无法导入 *.static.views

】Django1.1TemplateSyntaxError-无法导入*.static.views【英文标题】:Django1.1TemplateSyntaxError-couldnotimport*.static.views【发布时间】:2012-09-1003:53:24【问题描述】:我正在尝试将站点从使用Django1.1的旧服务器导入到新服务器上。由于兼容性原... 查看详情

jaxws-ri 和 jaxws-rt 有啥区别?

...什么区别?【发布时间】:2011-07-2101:22:14【问题描述】:查看来自java.net的JAX-WSMaven存储库-http://download.java.net/maven/2/com/sun/xml/ws/有两个类似的文件夹-ja 查看详情