gstreamerrtspbitrate

How to calculate real bitrate of incoming rtsp stream with GStreamer?


Is there any way to calculate real bitrate of incoming RTSP stream?

I've used "current-level-bytes" property of queue element, but result was unacceptable. I've also tried gst_element_query_duration with GST_FORMAT_BYTES on rtspsrc but it gives 0.


Solution

  • You can try gst-perf in your pipeline, it will display the framerate and the bitrate.

    If you want to know how to calculate the bitrate, take a look at the code. The plugin is a transform type, and in the transform handler gst_perf_transform_ip, the bitrate is calculated using the time between buffers and the buffer size (gst_util_get_timestamp, gst_buffer_get_size).

    If you have a pipeline in C, you can add this functionality to a appsrc/appsink part, or use a pad to catch all buffers, and do these operations.