当前位置: 首页 > news >正文

deepstream读取mp4文件及不同类型视频输入bug解决

在deepstream中使用mp4文件,与rtsp类似,使用uridecodebin即可,(可见官方test.py文件)

def create_source_bin(index, uri):print("Creating source bin")# Create a source GstBin to abstract this bin's content from the rest of the# pipelinebin_name = "source-bin-%02d" % indexprint(bin_name)nbin = Gst.Bin.new(bin_name)if not nbin:sys.stderr.write(" Unable to create source bin \n")# Source element for reading from the uri.# We will use decodebin and let it figure out the container format of the# stream and the codec and plug the appropriate demux and decode plugins.uri_decode_bin = Gst.ElementFactory.make("uridecodebin", "uri-decode-bin")if not uri_decode_bin:sys.stderr.write(" Unable to create uri decode bin \n")# We set the input uri to the source elementuri_decode_bin.set_property("uri", uri)# Connect to the "pad-added" signal of the decodebin which generates a# callback once a new pad for raw data has beed created by the decodebinuri_decode_bin.connect("pad-added", cb_newpad, nbin)uri_decode_bin.connect("child-added", decodebin_child_added, nbin)# We need to create a ghost pad for the source bin which will act as a proxy# for the video decoder src pad. The ghost pad will not have a target right# now. Once the decode bin creates the video decoder and generates the# cb_newpad callback, we will set the ghost pad target to the video decoder# src pad.Gst.Bin.add(nbin, uri_decode_bin)bin_pad = nbin.add_pad(Gst.GhostPad.new_no_target("src", Gst.PadDirection.SRC))if not bin_pad:sys.stderr.write(" Failed to add ghost pad in source bin \n")return Nonereturn nbin

1、错误:

Error: gst-resource-error-quark: Invalid URI “/home/打码/打码.mp4”. (3): gsturidecodebin.c(1383): gen_source_element (): /GstPipeline:pipeline0/GstBin:source-bin-03/GstURIDecodeBin:uri-decode-bin

解决方案:
如果是文件系统中的mp4文件,记得加上file://前缀,如将输入设为file:///home/打码/打码.mp4。

2.错误:

Error: gst-stream-error-quark: memory type configured and i/p buffer mismatch ip_surf 2 muxer 3 (1): gstnvstreammux.c(643): gst_nvstreammux_chain (): /GstPipeline:pipeline0/GstNvStreamMux:Stream-muxer

解决方案:
不同类型的输入(如rtsp流和mp4文件)会产生不同的内存类型,为了解决这个问题需要保证连接到streammux的输入产生相同的内存类型(即都是ftsp或者都是mp4)。或者,也可以找到下面的代码:

streammux.set_property("nvbuf-memory-type", mem_type)

将其注释掉即可。

http://www.lryc.cn/news/398821.html

相关文章:

  • Redis服务器统计和配置信息简介
  • Linux Mac 安装Higress 平替 Spring Cloud Gateway
  • 基于重叠群稀疏的总变分信号降噪及在旋转机械故障诊断中的应用(MATLAB)
  • 【YOLOv8】 用YOLOv8实现数字式工业仪表智能读数(一)
  • 微信小程序---npm 支持
  • 02MFC画笔/画刷/画椭圆/圆/(延时)文字
  • JavaWeb(四:Ajax与Json)
  • Spring源码中的模板方法模式
  • 初学SpringMVC之 JSON 篇
  • Mojo AI编程语言(三)数据结构:高效数据处理
  • Java学习笔记整理: 关于SpringBoot 2024/7/12;
  • ASP.NET MVC Lock锁的测试
  • Hadoop3:HDFS-通过配置黑白名单对集群进行扩缩容,并实现数据均衡(实用)
  • TensorFlow系列:第五讲:移动端部署模型
  • 深度学习DeepLearning二元分类 学习笔记
  • Eureka 介绍与使用
  • Java异常体系、UncaughtExceptionHandler、Spring MVC统一异常处理、Spring Boot统一异常处理
  • bash终端快捷键
  • 【Visual Studio】Visual Studio报错合集及解决办法
  • 【微信小程序知识点】转发功能的实现
  • 用python识别二维码(python实例二十三)
  • 电脑文件夹怎么设置密码?让你的文件更安全!
  • paddla模型转gguf
  • Memcached vs Redis——Java项目缓存选择
  • 大模型最新黑书:基于GPT-3、ChatGPT、GPT-4等Transformer架构的自然语言处理 PDF
  • 【电子数据取证】电子数据司法鉴定
  • 使用 OpenCV 的 inRange 函数进行颜色分割
  • OpenAI终止对中国提供API服务,对国内AI市场产生重大冲击?
  • JavaDS —— 栈 Stack 和 队列 Queue
  • C++进阶:继承和多态