打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
GStreamer使用tee创建分支

可以使用tee命令对一个视频流创建分支。将数据分割成多个数据流的分支。

需要在每个分支中使用单独的队列元素为每个分支提供单独的线程。否则一个分支阻塞数据流会阻塞其他分支

使用场景:捕获视频后,其中一个分支显示在屏幕,另一个分支写入文件。播放音频并且挂载可视化模块

输入源为测试视频、输出为两个流

1
2
3
4
5
6
//tee 测试视频 去掉延时  ----通过
gst-launch-1.0 videotestsrc pattern=pinwheel ! decodebin ! tee name=t ! queue ! videoconvert ! x264enc bitrate=1000 tune=zerolatency ! video/x-h264 ! h264parse ! video/x-h264 ! queue ! flvmux streamable=true ! rtmpsink location='rtmp://192.168.18.188/live/999' \ 
t. ! queue ! videoconvert ! x264enc ! flvmux streamable=true ! queue ! rtmpsink location='rtmp://192.168.18.188/live/888'

输入源为屏幕、输出为两个流

1
2
3
4
5
6
//tee 屏幕打流 去掉延时  ----通过
gst-launch-1.0 ximagesrc ! decodebin ! tee name=t ! queue ! videoconvert ! x264enc bitrate=1000 tune=zerolatency ! video/x-h264 ! h264parse ! video/x-h264 ! queue ! flvmux streamable=true ! rtmpsink location='rtmp://192.168.18.188/live/999'  t. ! queue ! videoconvert ! x264enc ! flvmux streamable=true ! queue ! rtmpsink location='rtmp://192.168.18.188/live/888'

输入源为屏幕、输出为两个流(其中一个流加延时)

关键参数:sync=false 设置为不同步否则。出去的两个流都存在延时。

而且一定要把tee的两个分支放在不同的queue中。

1
2
3
4
5
6
gst-launch-1.0 ximagesrc startx=0 use-damage=0 ! decodebin ! tee name=t ! queue ! videoconvert ! x264enc bitrate=1000 tune=zerolatency ! video/x-h264 ! h264parse ! video/x-h264 ! queue max-size-buffers=0 max-size-bytes=0 max-size-time=90000000000 !  queue max-size-buffers=0    max-size-time=90000000000 min-threshold-time=15000000000 ! flvmux streamable=true ! rtmpsink location='rtmp://192.168.18.188/live/999' t. ! queue ! videoconvert ! x264enc ! queue ! flvmux streamable=true ! rtmpsink location='rtmp://192.168.18.188/live/888' sync=false
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
gstreamer读取USB摄像头H264帧并用rtmp推流
gstreamer的video/x-raw-rgb插件
基于Gstreamer的实时视频流的分发
迅为IMX8MM开发板Yocto系统使用Gstarwmra播放音频和视频
Android PC投屏简单尝试(录屏直播)3
GStreamer基础教程10
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服