简体   繁体   中英

How to log GStreamer messages to a file

I have a video processing daemon (python), which runs several processes, some of which use GStreamer to get raw video frames to my custom elements (C). Some of the processes "freezes" (Process is_alive() = True , but Gstreamer pipeline doesn't do anything and doesn't call any python callbacks) - usually after 2-10 days, and only in production. I was unable to replicate this on my computer.

Now I have log files from python logging (main program) and glib logging (C plugin), but there is nothing helpful, even after I've added a lot more logging messages everywhere. So I hope there would be some clue in GStreamer's messages.

I run glib "main loop" in processes dedicated to video processing and then send messages with results using multiprocessing.Queue for further processing to another process. These gst/video-processes are a bit alien to python - there are a lot of callbacks from gstreamer and other gstreamer weirdnesses. Thats why I've isolated them in separate processes.

I have some python logging in the callbacks and a lot of glib logging in C plugin, but It's clearly not enough. Something probably fails between python program and C element. So I really need to see what's going on in GStreamer's guts.

Unfortunately, it seems to me that there is no way to debug Gstreamer other than by intercepting stderr .

I've tried to run the program without daemonization, set GST_DEBUG and store stderr into a gzipped file, but it doesn't help much, because I get all GStreamer messages mixed up in one HUGE file.

To sum this up:

  • I have a daemon (therefore no stderr, no stdout)
  • In the daemon, I have many child processes
  • Some of them (14 of them actually) run GStreamer pipelines
  • I have some mystery failures
  • I need GStreamer debug output badly
  • But I need GStreamer messages from each process written to a different file so I won't get lost in them
  • I don't know how to do this.

As suggested in comments, I could use GST_DEBUG_FILE env.variable, but that works from GStreamer 0.10.31. I have 0.10.30 so I can't use it.
Or I could write custom log handler, but since it would have to be written in python and `gst_debug_log_default' is not accesible from python bindings, this won't work either (maybe I'm wrong).

You will have write your own log handler. Here is a similar question and its answer. Please see if this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM