1. 輸出除錯字串
在執行GStreamer的程式前加上GST_DEBUG=N。N的數字越大,可以看到的除錯字串就越多。
$ GST_DEBUG=5 gst-launch-1.0 playbin uri=file:////home/ubuntu/Videos/test.avi
N值代表的意義如下:
如果想要對特定的module設定 可以如下設定:
$ GST_DEBUG=3,avidemux:5 gst-launch-1.0 playbin uri=file:////home/ubuntu/Videos/test.avi
這樣全局的Level設定為FIXME以下都會輸出。那對於avidemux這個模組則會是DEBUG以下都會輸出。這樣可以方便對某個模組進行除錯。因為GStreamer的除錯訊息真的是很多。
2. Dump Pipeline
首先要在程式碼中對要dump的pipline呼叫以下的函數:
GST_DEBUG_BIN_TO_DOT_FILE(GST_BIN(pipeline), GST_DEBUG_GRAPH_SHOW_ALL, "pipeline");
並在執行程式時加入GST_DEBUG_DUMP_DOT_DIR=xxxx,指定dot檔存放到哪個資料夾位置。這樣程式執行到這個地方就會將pipeline的內容dump成dot檔,並存在指定的資料夾位置。
$ GST_DEBUG_DUMP_DOT_DIR=/home/ubuntu gstreamer_test
輸出的dot檔可以利用dot來轉換成png檔方便你檢視:
$ sudo apt-get install graphviz
$ dot -Tpng pipeline.dot > pipeline.png
文章標籤
全站熱搜