DeepStream 多路拉取RTSP视频流

上一篇介绍DeepStream 如何集成Yolov4模型,那么本篇介绍下如何实现读取多路RTSP.

DeepStream 多路拉取RTSP视频流_第1张图片


代码 ⚡️​

  1. 主要代码参考: https://github.com/belarbi2733/deepstream-rtspsrc-yolo
  2. 详细代码参考作者实现,作者最后用RTSP输出,那么我暂时不需要,所以修改成输出屏幕显示。
  //sink = gst_element_factory_make ("udpsink", "udpsink");
  sink = gst_element_factory_make ("nveglglessink", "nvvideo-renderer");
  g_object_set(G_OBJECT(sink), "sync", FALSE, NULL);
  // g_object_set (G_OBJECT (sink), "host", "224.224.255.255", "port",
  //     5400, "async", FALSE, "sync", 0, NULL);
  1. 修改 pipeline 元素
  transform = gst_element_factory_make ("nvegltransform", "nvegl-transform");

  // gst_bin_add_many (GST_BIN (pipeline->pipeline),
  //     pipeline->multi_src_bin.bin, 
  //     pipeline->multi_src_bin.streammux,
  //     pgie, 
  //     tiler, 
  //     nvosd, 
  //     queue2, 
  //     nvvidconv2, 
  //     caps_filter, 
  //     encoder, 
  //     codecparser, 
  //     rtppay, 
  //     sink, 
  //     NULL);

    gst_bin_add_many (GST_BIN (pipeline->pipeline),
      pipeline->multi_src_bin.bin, 
      pipeline->multi_src_bin.streammux,
      pgie, 
      tiler, 
      nvosd,
      transform,
      sink, 
      NULL);
    if (!gst_element_link_many (pipeline->multi_src_bin.bin, 
                              pgie, 
                              tiler, 
                              nvosd, 
                              transform,
                              sink, 
                              NULL)) {
    g_printerr ("Elements could not be linked. Exiting.\n");
    return -1;
  }
  // ret = TRUE;d
  // ret = start_rtsp_streaming (8554, 5400, 0);
  // if (ret != TRUE) {
  //   g_print ("%s: start_rtsp_straming function failed\n", __func__);
  // }
  1. 识别模型换成yolov4模型,参考:https://blog.csdn.net/haiyangyunbao813/article/details/123303457?spm=1001.2014.3001.5501
[property]
gpu-id=0
net-scale-factor=0.0039215697906911373
#0=RGB, 1=BGR, 2=GRAY
model-color-format=0
model-engine-file=../nvdsinfer_custom_impl_Yolo/yolov4-csp-face.engine
## 0=FP32, 1=INT8, 2=FP16 mode
network-mode=2
num-detected-classes=1
gie-unique-id=1
network-type=0
is-classifier=0
## 0=Group Rectangles, 1=DBSCAN, 2=NMS, 3= DBSCAN+NMS Hybrid, 4 = None(No clustering)
cluster-mode=2
maintain-aspect-ratio=0
parse-bbox-func-name=NvDsInferParseYoloV4
custom-lib-path=../nvdsinfer_custom_impl_Yolo/libnvdsinfer_custom_impl_Yolo_plugins.so
#scaling-filter=0
#scaling-compute-hw=0
batch-size=1
interval=0 # 跳帧识别

[class-attrs-all]
pre-cluster-threshold=0.2
eps=0.2
group-threshold=1
nms-iou-threshold=0.6
pre-cluster-threshold=0.4
  1. 测试 ( 4路 ,8路 ) ​
./deepstream-rtspsrc-yolo-app <rtsp_source_uri_1> <rtsp_source_uri_2>



DeepStream 多路拉取RTSP视频流_第2张图片


END

内容主要分享下这位大哥如何实现的多路读取RTSP, 因为在网上没看到太好的介绍如何读取多路RTSP,基本都是如何推流。当然这位大哥最后也是使用RTSP推流,hahahah 。 有需要的小伙伴参考参考,就这样,See you .

大哥代码地址: https://github.com/belarbi2733/deepstream-rtspsrc-yolo
DeepStream 多路拉取RTSP视频流_第3张图片

你可能感兴趣的:(DeepStream,DeepStream,RTSP,Yolov4)