Measuring received video frame rate of rtsp video stream using gscam in ROS

Viewed 508

In my Ubuntu 18.04, I am receiving video from an IP camera and transmitting the video to a rtsp server using gscam in ROS melodic. Here is the code for the gscam nodelet in the launch file:

<node pkg="nodelet" type="nodelet"
name="nodelet_manager" args="manager"
output="screen"/>

<node pkg="nodelet" type="nodelet"
name="$(arg cam_name)"
args="load gscam/GSCamNodelet nodelet_manager"
output="screen">

<param name="camera_name"          value="$(arg cam_name)"/>
<param name="camera_info_url"      value="$(arg camera_info_url)"/>
<param name="frame_id"             value="$(arg cam_name)"/>
<param name="sync_sink"            value="true" />
<param name="use_gst_timestamps"   value="true" />
<param name="gst_clock_type"       value="0" />    <!-- GST_CLOCK_TYPE_REALTIME -->
<param name="reopen_on_eof"        value="true" />

<!-- choose appropriate gstreamer pipeline -->
<param name="gscam_config"
value="gst-launch-1.0 rtspsrc location=$(arg rtsp_stream) latency=$(arg latency) ! decodebin 
! videoconvert ! video/x-raw,format=RGB" />

<remap from="camera/image_raw" to="$(arg cam_name)/image_raw" />
</node>

Now, I would like to measure the received and dropped frame rate from the camera and from my research I have found that there is a gstreamer element fpsdisplay for this purpose.

If I try this launch operation from console :gst-launch-1.0 rtspsrc location=rtsp://192.168.17.168:553/stream latency=400 ! decodebin ! videoconvert ! fpsdisplaysink, then it displays the frame rate on a pooped up window but if I want to use fpsdisplay in the pipeline in the above gscam nodelet in the launch file like this:

<param name="gscam_config"
value="gst-launch-1.0 rtspsrc location=$(arg rtsp_stream) latency=$(arg latency) ! fpsdisplaysink ! decodebin ! videoconvert ! 
video/x-raw,format=RGB" />

then it does not work, no topics are published.

Through the documentations, I could not understand how to combine fpsdisplaysink in the gscam pipeline. How then this element has to be combined with the pipeline?

Or, if it is not clearly possible to get the received frame rate through fpsdisplaysink then how it can be done?

My main goal is not to show the fps on the screen but to get those values and then publish them as a ROS topic.

Thanks!

0 Answers
Related