- 安裝依賴
$ sudo apt-get install graphviz
- 添加自定義保存pipeline路徑的環境變量
$ sudo gedit ~/.bashrc
export GST_DEBUG_DUMP_DOT_DIR=/home/dreamdeck/Documents/code/pipeline/
$ source ~/.bashrc
- 修改deepstream源碼。在
g_main_loop_run(main_loop);
後面添加如下代碼:
/*GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS with timestamp */
/*print pipeline*/
GST_DEBUG_BIN_TO_DOT_FILE(GST_BIN (appCtx[0]->pipeline.pipeline),
GST_DEBUG_GRAPH_SHOW_ALL, "pipeline-playing");
注意修改appCtx[0]->pipeline.pipeline,這裏應該是pipeline。
- 繪製矢量圖(圖太大時位圖放大像素低,看不清),如果批量繪製,請直接跳轉步驟5
$ cd /home/nvidia/pipeline/
$ dot -Tsvg pipeline-playing.dot > pipeline-playing.pdf
- 批量繪製
新建.sh文件
$ touch gen-pipeline.sh
編寫.sh腳本(注意空行)
#!/bin/sh
INPUT_DIR="/home/dreamdeck/Documents/code/pipeline/"
DOT_FILES="${INPUT_DIR}*.dot"
for file in $DOT_FILES
do
dest=`sed s/.dot/.svg/ <<< "$file"`
dot -Tsvg $file > $dest
done
賦權限並批量生成
sudo chmod +x gen-pipeline.sh
./gen-pipeline.sh
- 通過瀏覽器打開矢量圖
(圖片爲部分結果截取)