流-FFMPEG-VLC

rtsp服务器参考:testOnDemandRTSPServer.cpp

https://www.cnblogs.com/cslunatic/p/3579706.html

ffmpeg可以打开rtsp流,本地文件等,参考雷神:

https://blog.csdn.net/leixiaohua1020/article/details/15811977

这里主要讲讲vlc:

1、参数参考:

https://www.cnblogs.com/saryli/p/5047924.html

2、c#使用vlc参考,我用过不错,还有源码。

https://blog.csdn.net/exalgentle/article/details/80303955

3、回调方式使用vlc播放libvlc_media_new_callbacks,参考。

https://blog.csdn.net/yangxun983323204/article/details/81231441

4、参数,参考1中的文档。这里说几个播放rtsp需要添加的

配置网络缓存时间:

    string delayConfig = ":network-caching=" + to_string(delayms);
    libvlc_media_add_option(mediat, delayConfig.c_str());

配置rtp播放器的网络端口,vlc默认5004-5005,同时播放多路视频可能出错,这里可以指定端口,防止出错。

    string portSpec = ":rtp-client-port=" + to_string(portvalx);
    libvlc_media_add_option(mediat, portSpec.c_str());

5、vlc不能播放h264文件,可能原因是,VLC源代码中明确规定解码时第一个NALU必须是SPS,故SEI放在前面会导致播放失败参考:Elecard StreamAnalyzer可以查看视频结构!

https://www.jianshu.com/p/7bc9e572e65d

我们可以在libx264编码器中添加判断:

int ret = x264_encoder_encode(pX264Handle, &pNals, &iNal, &Pic_in, &Pic_out);

 for (int i = 0; i < iNal; ++i)
 {
  switch (pNals[i].i_type)  //判断帧类型
  {
  case NAL_SPS:
   break;
  case  NAL_PPS:
   break;
  default:
   break;
  }
 }

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值