Skip to main content
This guide covers practical debugging techniques for QIM SDK AI pipelines — from enabling verbose logs to measuring per-stage latency, tracing buffers, and diagnosing camera or performance issues.

1. Enable Debug Logs

QIM SDK uses the standard GStreamer debug system. Pass --gst-debug=<level> to gst-launch-1.0, or set the GST_DEBUG environment variable for Python/C++ apps.

Debug Levels

Global Level

Per-Element Level

Override the global level for a specific plugin — useful for isolating one stage without drowning in output from everything else:

Common Starting Points

Python / C++ Apps

Redirect to File


2. Measure Pipeline KPIs (Latency per Stage)

Use the built-in GStreamer latency tracer to get per-element mean/min/max processing time for every stage — no custom instrumentation required.

Enable Tracing

Parse Results

Reading the Output

At 30 fps (33 ms budget per frame), the typical AI pipeline uses ~37% of the frame budget, leaving headroom for additional stages.

Measure FPS Live (On-Screen)

Add fpsdisplaysink in place of waylandsink to see FPS on the display in real time:

3. Measure Inference Performance

GST_TRACER (inferences/sec)

From the tracer output, calculate inferences/sec:
Example: mean = 5.71 ms1 / 0.00571 ≈ 175 inferences/sec

pidstat (CPU/Memory alongside inference)

This reports per-second CPU (%usr, %sys) and memory (RSS, VSZ) for the pipeline process.

4. Debug Performance Issues

Frame Drops

Frame drops manifest as:
  • Stuttering on the display
  • queue elements reporting overflows in debug logs (--gst-debug=4)
  • Tracer showing high max latency on inference (stage_01_inference)
Check for queue overflows:
Look for lines like:
Fix: Add max-size-time=0 max-size-bytes=0 max-size-buffers=3 to queues around inference:

Slow Throughput

If end-to-end latency is higher than expected:
  1. Run the latency tracer to find which stage is the bottleneck.
  2. Check if the inference delegate is correct — GPU delegate is much slower than HTP (NPU):
  1. Check model quantization — W8A8 (quantized) is significantly faster on the NPU than float32.

Memory Copies

Unnecessary buffer copies add latency. To detect them, enable memory tracing:
Use capture-io-mode=4 output-io-mode=4 on decoder/encoder elements to enable zero-copy DMA buffer passing:

5. Trace Buffers

Buffer tracing lets you follow a specific buffer through the pipeline to diagnose where it is dropped, delayed, or corrupted.

Enable Buffer Tracing

Each line shows a buffer’s PTS (presentation timestamp), DTS, size, and which pad it passed through.

Check for PTS Discontinuities

If frames are out of order or the pipeline stalls, look for timestamp jumps:

Use the Dot Graph (Pipeline Visualization)

Dump the pipeline as a .dot file to visually inspect element connections:

6. Debug Camera Issues

Common Errors

QMMF Recorder StartCamera Failed:
Fix: Kill and restart the camera server:
Then re-run the pipeline. The camera server restarts automatically on the next gst-launch-1.0 invocation.

Enable Camera Server Debug Logs

Camera Not Detected

ISP Camera (Config #2 / qticamsrc)

To switch from libcamera (Config #1) to qticamsrc (Config #2), write "camx" to the EFI variable:

Verify Camera Stream is Running


7. Quick Diagnostic Checklist

Run this sequence when a pipeline doesn’t work:

8. Report an Issue

When filing a bug or asking for help, include:
  1. Platform — Device model (e.g. RB3 Gen 2), OS (Ubuntu / Qualcomm Linux), QIM SDK version
  2. Full pipeline command — the exact gst-launch-1.0 or Python script
  3. Debug log — captured with --gst-debug=5 2> debug.log
  4. Tracer output — from gst-stats-1.0 if a performance issue
  5. Error message — the exact error line from the log
  6. Expected vs actual behaviour