15
12

More than 5 years have passed since last update.

gst-launch でエレメント間のレイテンシーを測る方法

Posted at

これは How to measure intra GStreamer/gst-launch latency のご紹介です。


GStreamer で開発していると「遅延は 0.x 秒まで」というような要求仕様に当たることが、しばしばあります。

例えば、以下のようなMP4 で mux してネットワーク配信をするパイプラインなどは、「遅延しているが、どこで遅延しているのか、見当がつかない。」そんな典型的な例です。

server
v4l2src ! videoconvert ! x264enc ! qtmux ! rtph264pay ! udpsink
client
udpsrc ! rtpbin.rtpsrc \
rtpbin. ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! autovideosink

この場合、わたしはいままで identity を使って「どのエレメントの処理に時間がかかっているか」を調べてきました。

参考までに ここidentity を使った計測コードがあります。

しかし、"エレメントを変えるたびにコンパイルしなければならない", "gst-launch では使えない" など、面倒な点がいくつかありました。

これを解決してくれそうなのが gstreamer_timestamp_marking です。

README にある通り markout を export して

$ export GST_DEBUG=markout:5

markinmarkoutで測定したい区間を囲って実行するだけ。

$ gst-launch-1.0 -f -e videotestsrc pattern=ball ! video/x-raw,width=320,height=240 ! markin name=moo ! videoscale ! markout ! video/x-raw,width=1280,height=720 ! ximagesink

とっても簡単ですね :)

15
12
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
15
12