29

How to view the output of functions like GST_CAT_INFO, GST_DEBUG etc? Do I need to compile gstreamer myself with debug level set or it can be done at application level?

0

6 Answers 6

36

Debugging messages can be printed in stderr by using the GST_DEBUG environment variable (if gstreamer has been compiled with --enable-gst-debug, which is default).

For example: GST_DEBUG=audiotestsrc:5 gst-launch audiotestsrc ! fakesink will log everything (5) from the audiotestsrc element.

You can change your program debugging output at runtime using setenv("GST_DEBUG","cat:level...", 1)

Sometime reading GStreamer debugging can be tedious. You can give gst-debug-viewer a try.

You can read the Documentation for other details.

4
  • cool! many thanks for the info. And this is how I redirected the output to a file. $ GST_DEBUG=audiotestsrc:5 gst-launch audiotestsrc ! fakesink 2> file.txt It should help me in debugging gstreamer. And the good thing is it is working in windows also. However, I am not getting any output from gst-debug-viewer. it shows the following info. in the shell but does not show any output in its window, just empty columns. tinypic.com/r/io16xi/3
    – vivek.m
    Jul 22, 2010 at 4:31
  • 1
    Hmm, I forgot to mention that gst-debug-viewer take output without colors. Try generating the log with GST_DEBUG_NO_COLOR=1
    – elmarco
    Jul 22, 2010 at 9:35
  • Didn't work for me at first but I had the call to GST_DEBUG() in the plugin_init() and not the element code, moving the statement to the element code corrected the problem. Note that: Debug Level 0 only outputs printfs, Debug Level 1 includes Level 0 output and also outputs GST_ERROR(), Level 2 includes Level 1 and also outputs GST_WARNING(), Level 3 includes Level 2 and also outputs GST_INFO(), Level 4 includes Level 3 and also outputs GST_DEBUG(), and Level 5 outputs everything.
    – Samuel
    Dec 26, 2012 at 21:53
  • 1
    Could someone please add an example with setenv("GST_DEBUG","cat:level...", 1) ? I am trying to figure out why this function is crashing: gst_element_set_state (pipeline, GST_STATE_NULL); Thanks. Jul 16, 2015 at 19:04
20

To show debug information for all categories, use something like

export GST_DEBUG="*:6"

before running your command.

2
  • 3
    To all levels you can directly go for GST_DEBUG="6" Mar 14, 2016 at 10:40
  • 1
    You can also get messages from python only plugins like that export GST_DEBUG="python:6". Can be used to debug plugin written in Python
    – quasoft
    Jan 22, 2017 at 18:40
8

The current documentation is here. Some interesting excerpts, in my opinion:

The '*' wildcard is also available. For example GST_DEBUG=2,audio*:5 will use Debug Level 5 for all categories starting with the word audio, and 2 for all the others.

Use gst-launch-1.0 --gst-debug-help to obtain the list of all registered categories.

GStreamer has the capability to output graph files. Example.

And the debug levels are:

| # | 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 may 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 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.           |
+------------------------------------------------------------------------------+
1

I added debug level:

gst-debug-level=4 {0->7}

It work without build gstreamer again

1

Besides all these correct answers I'd like to point to this graphical tool to ease Gstreamer debug analysis:

https://developer.ridgerun.com/wiki/index.php?title=How_to_Use_Gstreamer_Debug_Viewer

0

In my case, after compiling the program, executed:

GST_DEBUG=5 ./tutorial2

Where tutorial2 is the name of executable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.