GStreamer provides a built-in latency tracer that measures source-to-sink
latency per buffer. Enable it through environment variables when launching the
pipeline:
GST_DEBUG="GST_TRACER:7" \
GST_TRACERS="latency(flags=pipeline+element)" \
gst-launch-1.0 <pipeline>
The flags parameter controls what is measured:
pipeline– end-to-end source-to-sink latency (default).element– per-element latency between pads.reported– latency reported by each element via the LATENCY query.
Combine multiple flags with +, for example
latency(flags=pipeline+element+reported).
To write the tracer output to a file for offline analysis:
GST_DEBUG="GST_TRACER:7" \
GST_TRACERS="latency(flags=pipeline+element)" \
GST_DEBUG_FILE=latency.log \
gst-launch-1.0 <pipeline>
For the full tracer reference, see the upstream GStreamer documentation: latency tracer.