gstreamer基础教程11-Debugging tools

GStreamer 的调试工具 目标 有时一些事情没有按照预期的运行,但从总线(bus)获得的错误消息也没有提供足够的信息。幸运地是,GStreamer 带有大量的调试信息,它们通常可以对哪里出了问题给出一些提示。这里将介绍: 如何从 GStreamer 获得更多调试信息。 如何把自己的调试信息打印到 GStreamer 日志里。 如何获得管线图。 打印调试信息 调试日志 GStreamer 和它的插件充满了调试追踪,即,放置在有趣的特定代码片段处,信息片段将被打印到终端,伴随着时间戳,进程,种类,源码文件,函数,和元素信息。 调试输 阅读详情

索引:https://blog.youkuaiyun.com/knowledgebao/article/details/84621238

Goal

有事我们会出现一些错误,GSteam会给我们提供一些调试信息帮助我们来定位问题。主要包括:如何获取更多调试信息,如何将调试信息打印到日志里,如何获取pipeline图。

Sometimes things won’t go as expected and the error messages retrieved from the bus (if any) just don’t provide enough information. Luckily, GStreamer ships with附带 massive amounts of大量的 debug information, which usually hint暗示 what the problem might be. This tutorial shows:

  • How to get more debug information from GStreamer.

  • How to print your own debug information into the GStreamer log.

  • How to get pipeline graphs

Printing debug information

The debug log

GStreamer的调试信息包括:时间,代码所在文件名,代码行号,函数名等信息。下边是一条日志信息。

GStreamer and its plugins插件 are full of debug traces, this is, places in the code where a particularly interesting piece of information is printed to the console, along with time stamping, process, category, source code file, function and element information.

The debug output is controlled with the GST_DEBUG environment variable. Here’s an example with GST_DEBUG=2:

0:00:00.868050000  1592   09F62420 WARN                 filesrc gstfilesrc.c:1044:gst_file_src_start:<filesrc0> error: No such file "non-existing-file.webm"

GStream的日志信息非常全面,如果全部开启,可能会使控制栏卡死或者文件卡死。可以通过日志等级来定义显示哪些信息。

日志分类通过设置环境变量GST_DEBUG来实现:0:无错误。1:致命错误。2,警告。3:需要修复的。4,信息(流程性的)。5:调试信息。6:所有message。7:跟踪信息。8:堆栈信息。其中等级是包含关系,比如设置level为4的话,1,2,3,4类型的信息都会打印。

可以针对指定的element进行日志等级设置,可以通过通配符*设置包含指定内容的element的日志等级。GStream日志可以写到文件里边,通过对日志文件的检索,定位问题原因。

As you can see, this is quite a bit of information. In fact, the GStreamer debug log is so verbose冗余, that when fully enabled it can render致使 applications unresponsive (due to the console scrolling) or fill up megabytes百万字节 of text files (when redirected to a file). For this reason, the logs are categorized分类, and you seldom很少 need to enable all categories at once.

The first category is the Debug Level, which is a number specifying the amount of desired output:

| # | Name    | Description                                                    |
|---|---------|----------------------------------------------------------------|
| 0 | none    | No debug information is output.                                |
| 1 | ERROR   | Logs all fatal errors. These are errors that do not allow the  |
|   |         | core or elements to perform the requested action. The          |
|   |         | application can still recover if programmed to handle the      |
|   |         | conditions that triggered the error.                           |
| 2 | WARNING | Logs all warnings. Typically these are non-fatal, but          |
|   |         | user-visible problems are expected to happen.                  |
| 3 | FIXME   | Logs all "fixme" messages. Those typically that a codepath that|
|   |         | is known to be incomplete has been triggered. It may work in   |
|   |         | most cases, but mauy cause problems in specific instances.     |
| 4 | INFO    | Logs all informational messages. These are typically used for  |
|   |         | events in the system that only happen once, or are important   |
|   |         | and rare enough to be logged at this level.                    |
| 5 | DEBUG   | Logs all debug messages. These are general debug messages for  |
|   |         | events that happen only a limited number of times during an    |
|   |         | object's lifetime; these include setup, teardown, change of    |
|   |         | parameters, etc.                                               |
| 6 | LOG     | Logs all log messages. These are messages for events that      |
|   |         | happen repeatedly during an object's lifetime; these include   |
|   |         | streaming and steady-state conditions. This is used for log    |
|   |         | messages that happen on every buffer in an element for example.|
| 7 | TRACE   | Logs all trace messages. Those are message that happen very    |
|   |         | very often. This is for example is each each time the reference|
|   |         | count of a GstMiniObject, such as a GstBuffer or GstEvent, is  |
|   |         | modified.                                                      |
| 8 | MEMDUMP | Logs all memory dump messages. This is the heaviest logging and|
|   |         | may include dumping the content of blocks of memory.           |
+------------------------------------------------------------------------------+

To enable debug output, set the GST_DEBUG environment variable to the desired debug level. All levels below that will also be shown (i.e., if you set GST_DEBUG=2, you will get both ERROR and WARNING messages).

Furthermore, each plugin or part of the GStreamer defines its own category, so you can specify a debug level for each individual category. For example, GST_DEBUG=2,audiotestsrc:6, will use Debug Level 6 for the audiotestsrc element, and 2 for all the others.

The GST_DEBUG environment variable, then, is a comma-separated list of category:level pairs, with an optional levelat the beginning, representing the default debug level for all categories.

The '*' wildcard通配符 is also available. For example GST_DEBUG=2,audio*:6 will use Debug Level 5 for all categories starting with the word audio. GST_DEBUG=*:2 is equivalent to GST_DEBUG=2.

Use gst-launch-1.0 --gst-debug-help to obtain the list of all registered categories. Bear in mind that each plugin registers its own categories, so, when installing or removing plugins, this list can change.

Use GST_DEBUG when the error information posted on the GStreamer bus does not help you nail down确定 a problem. It is common practice to redirect the output log to a file, and then examine it later, searching for specific messages.

GStreamer allows for custom debugging information handlers but when using the default one, the content of each line in the debug output looks like:

0:00:00.868050000  1592   09F62420 WARN                 filesrc gstfilesrc.c:1044:gst_file_src_start:<filesrc0> error: No such file "non-existing-file.webm"

And this is how the information formatted:

| Example          | Explained                                                 |
|------------------|-----------------------------------------------------------|
|0:00:00.868050000 | Time stamp in HH:MM:SS.sssssssss format since the start of|
|                  | the program.                                              |
|1592              | Process ID from which the message was issued. Useful when |
|                  | your problem involves multiple processes.                 |
|09F62420          | Thread ID from which the message was issued. Useful when  |
|                  | your problem involves multiple threads.                   |
|WARN              | Debug level of the message.                               |
|filesrc           | Debug Category of the message.                            |
|gstfilesrc.c:1044 | Source file and line in the GStreamer source code where   |
|                  | this message was issued.                                  |
|gst_file_src_start| Function that issued the message.                         |
|<filesrc0>        | Name of the object that issued the message. It can be an  |
|                  | element, a pad, or something else. Useful when you have   |
|                  | multiple elements of the same kind and need to distinguish|
|                  | among them. Naming your elements with the name property   |
|                  | makes this debug output more readable but GStreamer       |
|                  | assigns each new element a unique name by default.        |
| error: No such   |                                                           |
| file ....        | The actual message.                                       |
+------------------------------------------------------------------------------+

Adding your own debug information

通过宏GST_DEBUG_CATEGORY_INIT以及GST_ERROR(), GST_WARNING(), GST_INFO(), GST_LOG() and GST_DEBUG()可以利用GStream的日志系统添加自己的调试信息。GST_DEBUG_CATEGORY_INIT需要在gst_init()之后调用。

In the parts of your code that interact with相互作用 GStreamer, it is interesting to use GStreamer’s debugging facilities. In this way, you have all debug output in the same file and the temporal relationship between different messages is preserved.

To do so, use the GST_ERROR(), GST_WARNING(), GST_INFO(), GST_LOG() and GST_DEBUG() macros. They accept the same parameters as printf, and they use the default category (default will be shown as the Debug category in the output log).

To change the category to something more meaningful, add these two lines at the top of your code:

GST_DEBUG_CATEGORY_STATIC (my_category);
#define GST_CAT_DEFAULT my_category

And then this one after you have initialized GStreamer with gst_init():

GST_DEBUG_CATEGORY_INIT (my_category, "my category", 0, "This is my very own");

This registers a new category (this is, for the duration of your application: it is not stored in any file), and sets it as the default category for your code. See the documentation for GST_DEBUG_CATEGORY_INIT().

Getting pipeline graphs

获取通道构件图。.dot图片文件可以自动生成。(.dot是一种类似于visio的图片文件,使用开源工具GraphViz可以打开,会显示控件之间的关联)

通过设置环境变量GST_DEBUG_DUMP_DOT_DIR,设置图片.dot的存储目录后,gst-launch-1.0在每次状态变化的时候,自动创建.dot文件。g_setenv("GST_DEBUG_DUMP_DOT_DIR", "/home/test", TRUE);切记:此函数必须在gst_init (&argc, &argv)之前调用。包括一些其他环境变量应该也一样需要放在init之前。

开发人员也可以通过宏GST_DEBUG_BIN_TO_DOT_FILE()、GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS()实时生成.dot文件。

For those cases where your pipeline starts to grow too large and you lose track of what is connected with what, GStreamer has the capability to output graph files. These are .dot files, readable with free programs like GraphViz, that describe the topology of your pipeline, along with the caps negotiated in each link.

This is also very handy when using all-in-one elements like playbin or uridecodebin, which instantiate several elements inside them. Use the .dot files to learn what pipeline they have created inside (and learn a bit of GStreamer along the way).

To obtain获取 .dot files, simply set the GST_DEBUG_DUMP_DOT_DIR environment variable to point to the folder where you want the files to be placed. gst-launch-1.0 will create a .dot file at each state change, so you can see the evolution of the caps negotiation. Unset the variable to disable this facility. From within your application, you can use the GST_DEBUG_BIN_TO_DOT_FILE() and GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS() macros to generate .dot files at your convenience.

Here you have an example of the kind of pipelines that playbin generates. It is very complex because playbin can handle many different cases: Your manual pipelines normally do not need to be this long. If your manual pipeline is starting to get very big, consider using playbin.

To download the full-size picture, use the attachments link at the top of this page (It's the paperclip icon).

Conclusion

This tutorial has shown:

  • How to get more debug information from GStreamer using the GST_DEBUG environment variable.
  • How to print your own debug information into the GStreamer log with the GST_ERROR() macro and relatives.
  • How to get pipeline graphs with the GST_DEBUG_DUMP_DOT_DIR environment variable.

It has been a pleasure having you here, and see you soon!


gStreamer 官方教程资源大全 1. 入门教程:Basic tutorials 这里列一个GStreamer入门课程清单,大家按需选择吧。 基础教程1:Hello world!—— 惯例性的 “Hello world” 程序 基本教程2:GStreamer概念 基础教程3:动态管道 基础教程4:时间管理 基础教程5: GUI工具包集成 基础教程6:媒体格式和Pad功能 基本教程7:多线程和Pad可用性 基础教程8:管道短路操作 基础教程9:媒体信息收集 基本教程10:GStreamer工具 基本教程11:调试工具 基础教程12:流媒体 基 阅读详情

相关推荐

gstreamer 学习资料汇总

1、github源代码 https://github.com/GStreamer/gstreamer 2、github有人写的一个example https://github.com/gesanqiu/gstreamer-example 3、gstreamer中文开发手册 https://www.doczhi.com/p-834602.html 《插件编写指南》 4、gstreamer官方API https://gstreamer.freedesktop.org/documentation/libs.htm

weixin_43360707的博客 1512

GStreamer基础教程之调试工具

目标 有时,程序不能按照预期的执行并且从bus检索到的错误消息也不能提供足够多的信息。幸运的是,GStreamer携带有大量的调试信息,这些信息通常会提示我们可能存在的问题。这个教程的目标: 怎样从GStreamer获取到更多的debug 信息。 怎么样打印自己的debug信息到GStreamer 日志。 怎样获取到管道的图表。 打印debug信息 debug日志 GStreamer和它的插件充满了调试信息的跟踪。这就是说,在代码中的位置,有一段特别有趣的信息片段被打印到控制台,以及时间戳、..

m_wordPlan的博客 2086

GStreamer基础教程11:调试工具

目标 有时我们的应用并没有按照我们的预期来工作,并且在总线上获得的错误信息也没有足够的内容。这时我们该怎么办呢?幸运的时,GStreamer自身提供了大量的调试信息,通常这些信息会给出一些线索,指向出错的地方。本教程主要讲述: 如何在GStreamer里面获得更多地调试信息 如何把你自己的调试信息加入GStreamer的调试记录 如何获得图形化的pipeline 打印调试信息 调试记录 ...

ZONGXP的博客 2146

【GStreamer 基础】Debugging Tools

一、Goal 对 gstreamer 的调试,我们可能会期待 bus 上 Error 的抛出,但是大多数时候,事情总没有那么顺利。但其实 gstream 有大量的调试信息,这里将演示如何进行调试。 如何得到更多的 GStreamer 日志 如何打印自己的 debug 信息 到 GStreamer 的日志中 如何得到 pipeline 的图表 二、Printing debug information 2.1 日志等级说明 GStreamer和它的插件都包含了调试跟踪,时间戳、过程、类别、源代码文件、函数和

TimeTravelx的博客 2522

1、gstreamer基础教程-播放视频

基本思想:只是单纯记录一下官方的例子,具体信息看官方手册,本菜也是参考官方手册学习。

sxj731533730 1137

ADS2023仿真变容二极管特性

仿真S-Param仿真控件,设置为Single Point,将频率设置为1MHz,同时勾选Z-parameters,取消S-parameters,从元件库中选择元器件搭建原理图,并根据器件spice提供的相关参数,对原理图中器件参数进行修改,修改完成的电路图如下图所示。添加var控件和MeasEqn控件,相关设置如图所示,Ct为变容管的电容值,Q0为其品质因数。因此,对变容二极管的模型仿真结果是可以信赖的。将其解压,在spice文件夹中,可以找到我们想要的器件参数,和仿真简要电路图。

weixin_45811090的博客 1万+

Gstreamer学习笔记(1):GStreamer Debugging

Create DOT file to see exact pipeline and capabilities used(使用 gst dump 出 pipeline 构成图) In order to generate a DOT file, set the GST_DEBUG_DUMP_DOT_DIR environment variable to point to the folder whe...

houxiaoni01的博客 2774

北京绿盟科技安服实习生面经

记一次绿盟校招技术面经历,人生第一次面试,该说不说还是很紧张的,以下是技术面的一些问题,欢迎各位大佬在评论区补充纠正对于面试的问题,都应该自己下来深度去拓展学习,面试官问的问题刚好可以检测我们自己对某个模块的学习情况,借此更好的进行总结和学习。

qq_51690690的博客 3231

GStreamer——教程——基础教程11:Debugging tools

在您的应用程序中,您可以使用GST_DEBUG_BIN_TO_DOT_FILE()和GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS()宏根据您的需要生成.dot文件。此外,每个插件或GStreamer的一部分都定义了自己的类别,因此您可以为每个单独的类别指定一个调试级别。这注册了一个新的类别(在您的应用程序期间:它不会存储在任何文件中),并将其设置为代码的默认类别。然后,GST_DEBUG环境变量是一个逗号分隔的类别:级别对列表,可选级别位于开头,表示所有类别的默认调试级别。

FREEDOM_X的专栏 1254

LMX2594时钟配置实战:TICS PRO从入门到寄存器导出

本文详细介绍了LMX2594时钟芯片的配置实战,重点讲解了如何使用TICS PRO调试软件简化复杂的寄存器设置过程。通过实例演示从基础频率配置到高级参数调优的全流程,并分享SPI写入的嵌入式系统移植技巧,帮助工程师快速掌握高性能时钟芯片的配置方法。

weixin_29189003的博客 552

手把手教你用FPGA实现SGMII接口:从IP核配置到板级调试全流程

本文详细介绍了如何在Xilinx 7系列FPGA上实现SGMII(Serial Gigabit Media Independent Interface)接口的全流程,包括IP核配置、约束编写和硬件调试。通过具体的硬件选型建议、软件工具链配置和PCB设计规范,帮助开发者快速构建稳定可靠的千兆通信链路,并提供了常见故障排查和性能优化技巧。

weixin_29194693的博客 296

GStreamer Tutorial 中文翻译:Basic tutorial 11: Debugging tools

GStreamer Tutorial 11中文翻译 文章目录GStreamer Tutorial 11中文翻译前言[Basic tutorial 11: Debugging tools](https://gstreamer.freedesktop.org/documentation/tutorials/basic/debugging-tools.html?gi-language=c)目的打印调试信息调试日志添加您自己的调试信息生成pipeline图结论 前言 由于工作原因,用的GStreamer的图像解

wuchangwen0216的博客 367

Landsat9 地表温度反演方法

landsat9地表温度反演及缺失值处理方法

xiangliu12345的博客 3917

【Gstreamer 11】基础教程之 调试工具

Gstreamer 基础教程之 调试工具

Jayson 博客 1161

YOLOv9改进策略 | Conv篇 | 2024最新ECCV最新大感受野的小波卷积WTConv助力YOLOv9有效涨点

本文给大家带来的改进机制是一种新的卷积层,称为WTConv(小波卷积层),它利用小波变换(WT)来解决卷积神经网络(CNN)在实现大感受野时遇到的过度参数化问题。WTConv的主要目的是通过对输入数据的不同频率带进行处理,使CNN能够更有效地捕捉局部和全局特征,WTConv成功解决了CNN在感受野扩展中的参数膨胀问题,提供了一种更为高效、鲁棒且易于集成的卷积层解决方案,我将其用于二次创新YOLOv9中的RepNCSPELAN4机制可以减少一定的参数量和计算量,达到一个可观的轻量化作用。

Snu77的博客 1543

手把手教你学Simulink实例:基于Simulink的锂电池管理系统(BMS)仿真

是确保锂电池安全、高效运行的关键组件。BMS 主要功能包括监控电池的状态(如电压、电流、温度)、估算荷电状态(State of Charge, SOC)、健康状态(State of Health, SOH),以及实现电池均衡和保护机制等。Simulink 提供了一个强大的仿真环境,可以用来设计、分析和验证锂电池管理系统的控制策略。常见的均衡方法包括被动均衡(通过电阻放电)和主动均衡(通过开关电容或变压器)。通过本教程,我们详细介绍了如何使用 Simulink 进行锂电池管理系统的仿真实例。

MHD0815的博客 538

linux arm64 Qt6/PySide6 WebEngine 支持 webrtc -h264 编译参考

3、GCC10+,CMake20+,nodejs20+ ,这些看系统升级的版本,达不到需要源码编译安装。使用的qt6开发,默认的浏览器插件qtwebengine是不支持webrtc,需要自己手动编译源码。客户端程序,需要运行在国产化机器上,程序里有web模块,并且需要播放webrtc的视频。2、Linux 6.7版本以后才支持arm64,并且需要在Debian系统下。4、只要不报错,继续执行就可以。严格参考官方文档的支持环境可行性!银河麒麟V10 aarch64。把整个目录覆盖到QT目录下即可。

hellozp的专栏 3900

Open3d Qt的环境配置

目前统一使用qt6配置,open3d中可视化功能目前使用vtk代替,语言为c++。

阁楼 919

从专用引擎到Qt框架:游戏项目移植的模块化重构实战

在软件开发中,项目移植与重构是常见的工程实践,尤其当老旧项目依赖特定、封闭的运行时环境时。其核心原理在于解耦与模块化:通过分析原有系统的功能边界,将高度耦合的代码拆分为独立的、职责清晰的组件,如渲染、音频、资源管理与游戏逻辑。这种做法的技术价值在于提升代码的可维护性、可测试性与跨平台能力,是项目现代化和产品化的重要步骤。典型的应用场景包括复活遗留的演示程序、将研究原型转化为可分发应用,或是为特定引擎(如文中的“PE引擎”)项目寻找更通用的技术栈。本文即以一个具体的单曲项目为例,详细阐述了如何利用Qt框架的信

weixin_33895695的博客 398

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

GStreamer基础教程13 - 调试Pipeline

GStreamer基础教程13 - 调试Pipeline

jacke121的专栏 1804

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

gstreamer的source开发流程

gstreamer,gst,插件

baidxi的博客 669

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

GStreamer学习二(调试日志)

GStreamer的调试子系统 是获取应用程序正在执行操作信息的简单方法。它不适用于编程错误,使用GLib方法(g_warning等)。仅在GStreamer初始化调用gst_init后才能工作,调试子系统用于在应用程序运行时记录信息性消息。每条消息都附加了一些属性。这些属性包括调试类别,严重性(此处称为“级别”)和它所属的可选GObject。这些消息中的每一个都被发送到所有已注册的调试处理程序,然后处理这些消息。GStreamer在启动时附加一个默认处理程序,它将请求的消息输出到stderr。 .

cai742925624的专栏 1626

GStreamer使用详解

使用系统自带的源,安装过程中会报错,因此先切换源,这里优先选择清华的源,阿里的源部分不维护,会安装报错。 1.备份原来的源,将以前的源备份一下,以防以后可以用的。 sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak 2.打开/etc/apt/sources.list文件,在前面添加如下条目,并保存。 sudo vim /etc/apt/sources.list 3.摁i进入插入模式 4.然后摁 键盘的delete删除原有的源 ...

程序猿老樊的博客 6133

GStreamer基础教程11——调试工具

有时我们的应用并没有按照我们的预期来工作,并且在总线上获得的错误信息也没有足够的内容。这时我们该怎么办呢?幸运的时,GStreamer自身提供了大量的调试信息,通常这些信息会给出一些线索,指向出错的地方。

sakulafly的专栏 1万+

gsteamer日志输出实例

在Gstreamer中日志输出非常强大,可以根据category设置需要显示的部分,还可以设置颜色,突出显示。codec2dec是codec2dec_debug的name,定义好之后,在代码中通过GST_DEBUG输出log,在命令行用这样的环境变量来打开,就可以看到log输出了。\其中GST_DEBUG_BOLD是color flag,定义在文件中,可以设置前景色,背景色,粗体和下划线。

技术笔记 1147

详细的GStreamer开发教程

详细的GStreamer开发教程 文章目录详细的GStreamer开发教程1. 什么是GStreamer?2. GStreamer架构2.1 Media Applications2.2 Core Framework2.3 Plugins3. GStreamer组件3.1 Element创建一个 GstElement3.2 箱柜(bin)元件的状态3.3 衬垫(Pad)元件链接(Pad link)...

HanBlogs 4万+
上一篇: gstreamer基础教程10-GStreamer tools
下一篇: gstreamer基础教程12-Streaming
knowledgebao
博客等级 码龄15年 401粉丝 198原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值