Gst-nvstreamdemux插件将批处理的帧解复用到单独的缓冲区中。它为批处理中的每个帧创建一个单独的Gst缓冲区。它不复制视频帧。每个Gst缓冲区包含一个指向批处理中相应帧的指针。该插件将未批处理的Gst缓冲区对象推到相应于每帧源的垫下游。插件通过Gst-nvstreammux附加的NvDsBatchMeta来获取这个信息。单个帧的原始缓冲区时间戳(PTS)也附加回Gst缓冲区。由于没有帧拷贝,输入的Gst Buffer不会立即返回上游。当所有从输入批处理Gst Buffer中解耦的非批处理Gst Buffer对象被下游组件返回给解耦器时,输入批处理Gst缓冲区被上游返回。即使Gst-nvstreammux对缓冲区进行了缩放,demuxer也不会将缓冲区缩放回源的原始分辨率。
![](https://i-blog.csdnimg.cn/blog_migrate/666c34df1183a62575c49a001d164110.png)
输入和输出
输入
Gst缓冲区(批量)
NvDsBatchMeta
其它Meta
控制参数
没有一个
输出
Gst缓冲区(非批量,单一来源)
与每个Gst缓冲区源相关的Meta
这个插件可以用以下管道测试:
用例1
使用nvstreammux将两个视频源混合在一起。
muxer的输出被配置为batch-size=2的nvinfer。
在nvinfer之后,我们使用nvstreamdemux在两个独立的窗口上显示视频源0和1的内容,以及使用nvdsosd插件对每个覆盖的推断输出。
管道(x86):
gst-launch-1.0 -e nvstreammux name=mux batch-size=2 width=1920 height=1080 ! nvinfer config-file-path=/opt/nvidia/deepstream/deepstream/samples/configs/deepstream-app/config_infer_primary.txt batch-size=2
! nvstreamdemux name=demux filesrc location=/ opt/nvidia/deepstream/deepstream/samples/streams/sample_1080p_h264.mp4 ! qtdemux ! h264parse ! nvv4l2decoder ! queue !
mux.sink_0 filesrc location=/opt/nvidia/deepstream/deepstream/samples/streams/sample_720p.h264 ! h264parse ! nvv4l2decoder !
queue ! mux.sink_1 demux.src_0 ! "video/x-raw(memory:NVMM), format=NV12" ! queue ! nvvideoconvert ! "video/x-raw(memory:NVMM), format=RGBA" ! nvdsosd !
nvvideoconvert ! nveglglessink demux.src_1 ! queue ! "video/x-raw(memory:NVMM), format=NV12" ! queue ! nvvideoconvert ! "video/x-raw(memory:NVMM), format=RGBA" ! nvdsosd ! nveglglessink
管道(Jetson):
gst-launch-1.0 -e nvstreammux name=mux batch-size=2 width=1920 height=1080 ! nvinfer config-file-path=/opt/nvidia/deepstream/deepstream/samples/configs/deepstream-app/config_infer_primary.txt batch-size=2 !
nvstreamdemux name=demux filesrc location=/opt/nvidia/deepstream/deepstream/samples/streams/sample_1080p_h264.mp4 ! qtdemux ! h264parse ! nvv4l2decoder ! queue !
mux.sink_0 filesrc location=/opt/nvidia/deepstream/deepstream/samples/streams/sample_720p.h264 ! h264parse ! nvv4l2decoder ! queue ! mux.sink_1 demux.src_0 ! "video/x-raw(memory:NVMM), format=NV12" !
queue ! nvvideoconvert ! "video/x-raw(memory:NVMM), format=RGBA" ! nvdsosd ! nvvideoconvert ! nv3dsink demux.src_1 ! queue ! "video/x-raw(memory:NVMM), format=NV12" ! queue ! nvvideoconvert ! "video/x-raw(memory:NVMM), format=RGBA" ! nv3dsink
用例2
使用nvstreammux将两个视频源混合在一起。
muxer的输出被配置为batch-size=2的nvinfer。
在nvinfer之后,我们使用nvstreamdemux将视频源0的内容与使用nvdsosd插件覆盖的推断输出一起写入一个文件。
视频源1后demux的内容直接显示在屏幕上使用nveglglessink插件
管道(x86):
gst-launch-1.0 -e nvstreammux name=mux batch-size=2 width=1920 height=1080 ! nvinfer config-file-path=/opt/nvidia/deepstream/deepstream/samples/configs/deepstream-app/config_infer_primary.txt batch-size=2 ! nvstreamdemux name=demux filesrc location=/opt/nvidia/deepstream/deepstream/samples/streams/sample_720p.h264 ! h264parse ! nvv4l2decoder ! queue ! mux.sink_0 filesrc location=/opt/nvidia/deepstream/deepstream/samples/streams/sample_720p.h264 ! h264parse ! nvv4l2decoder ! queue ! mux.sink_1 demux.src_0 ! "video/x-raw(memory:NVMM), format=NV12" ! queue ! nvvideoconvert ! "video/x-raw(memory:NVMM), format=RGBA" ! nvdsosd ! nvvideoconvert ! nvv4l2h264enc ! h264parse ! qtmux ! filesink location=./out.mp4 demux.src_1 ! queue ! nveglglessink
管道(Jetson):
gst-launch-1.0 -e nvstreammux name=mux batch-size=2 width=1920 height=1080 ! nvinfer config-file-path=/opt/nvidia/deepstream/deepstream/samples/configs/deepstream-app/config_infer_primary.txt batch-size=2 ! nvstreamdemux name=demux filesrc location=/opt/nvidia/deepstream/deepstream/samples/streams/sample_720p.h264 ! h264parse ! nvv4l2decoder ! queue ! mux.sink_0 filesrc location=/opt/nvidia/deepstream/deepstream/samples/streams/sample_720p.h264 ! h264parse ! nvv4l2decoder ! queue ! mux.sink_1 demux.src_0 ! "video/x-raw(memory:NVMM), format=NV12" ! queue ! nvvideoconvert ! "video/x-raw(memory:NVMM), format=RGBA" ! nvdsosd ! nvvideoconvert ! nvv4l2h264enc ! h264parse ! qtmux ! filesink location=./out.mp4 demux.src_1 ! queue ! nv3dsink
用例3
用例3演示了在两个单独的窗口中显示两个流。
使用nvstreammux将两个视频源混合在一起。
muxer的输出被配置为batch-size=2的nvinfer。
在nvinfer之后,我们使用nvstreamdemux在两个独立的窗口上显示视频源0和1的内容。
管道(x86):
gst-launch-1.0 -e nvstreammux name=mux batch-size=2 width=1920 height=1080 ! nvinfer config-file-path=/opt/nvidia/deepstream/deepstream/samples/configs/deepstream-app/config_infer_primary.txt batch-size=2 ! nvstreamdemux name=demux filesrc location=/opt/nvidia/deepstream/deepstream/samples/streams/sample_720p.h264 ! h264parse ! nvv4l2decoder ! queue ! mux.sink_0 filesrc location=/opt/nvidia/deepstream/deepstream/samples/streams/sample_720p.h264 ! h264parse ! nvv4l2decoder ! queue ! mux.sink_1 demux.src_0 ! queue ! nvvideoconvert ! nveglglessink demux.src_1 ! queue ! nveglglessink
管道(Jetson):
gst-launch-1.0 -e nvstreammux name=mux batch-size=2 width=1920 height=1080 ! nvinfer config-file-path=/opt/nvidia/deepstream/deepstream/samples/configs/deepstream-app/config_infer_primary.txt batch-size=2 ! nvstreamdemux name=demux filesrc location=/opt/nvidia/deepstream/deepstream/samples/streams/sample_720p.h264 ! h264parse ! nvv4l2decoder ! queue ! mux.sink_0 filesrc location=/opt/nvidia/deepstream/deepstream/samples/streams/sample_720p.h264 ! h264parse ! nvv4l2decoder ! queue ! mux.sink_1 demux.src_0 ! queue ! nv3dsink demux.src_1 ! queue ! nv3dsink