How to get number of frames?
I used a Intel® RealSense™ Depth Camera D435 to record several videos. I am very new to ROSBAG.
I am using rs-convert to extract PNG frames from a .bag file. However, I noticed that frames have been dropped, and I am trying to identify whether the frames were dropped during recording or during extraction. To do this, I need to check the number of frames in the original .bag file.
How can I use the rosbag command line tools to find the number of frames in a .bag file?
(I have installed the melodic rosdistro on Ubuntu 18.04.)
EDIT:
After using the rs-convert
tool to extract PNG files, I was able to get 20879 PNG frames.
Is the "duration" the true length of the video? Since I know the D435 camera records at 30fps, I could do 20879 frames/ 699s = 29.87fps --> close enough to 30fps --> conclusion: no frames were dropped.
Below is the output when I run rosbag info <BAG_FILE>
. Any insight on the output of this would be helpful, as I am very new to all this.
path: <BAG_FILENAME>.bag
version: 2.0
duration: 11:39s (699s)
start: Dec 31 1969 19:00:00.00 (0.00)
end: Dec 31 1969 19:11:39.81 (699.81)
size: 35.9 GB
messages: 125361
compression: lz4 [20883/20883 chunks; 66.67%]
uncompressed: 53.8 GB @ 78.7 MB/s
compressed: 35.9 GB @ 52.5 MB/s (66.67%)
types: diagnostic_msgs/KeyValue [cf57fdc6617a881a88c16e768132149c]
geometry_msgs/Transform [ac9eff44abf714214112b05d54a3cf9b]
realsense_msgs/StreamInfo [311d7e24eac31bb87271d041bf70ff7d]
sensor_msgs/CameraInfo [c9a58c1b0b154e0e6da7578cb991d214]
sensor_msgs/Image [060021388200f6f0f447d0fcd9c64743]
std_msgs/Float32 [73fcbf46b49191e672908e50842a83d4]
std_msgs/String [992ce8a1687cec8c8bd883ec73ca41d1]
std_msgs/UInt32 [304a39449588c7f8ce2df6e8001c5fce]
topics: /device_0/info 9 msgs : diagnostic_msgs/KeyValue
/device_0/sensor_0/info 1 msg : diagnostic_msgs/KeyValue
/device_0/sensor_0/option/Depth Units/description 1 msg : std_msgs/String
/device_0/sensor_0/option/Depth Units/value 1 msg : std_msgs/Float32
/device_0/sensor_0/option/Emitter Enabled/description 1 msg : std_msgs/String
/device_0/sensor_0/option/Emitter Enabled/value 1 msg : std_msgs/Float32
/device_0/sensor_0/option/Enable Auto Exposure/description 1 msg : std_msgs/String
/device_0/sensor_0/option/Enable Auto Exposure/value 1 msg : std_msgs/Float32
/device_0/sensor_0/option/Error Polling Enabled/description 1 msg : std_msgs/String
/device_0/sensor_0/option/Error Polling Enabled/value 1 msg : std_msgs/Float32
/device_0/sensor_0/option/Exposure/description 1 msg : std_msgs/String
/device_0/sensor_0/option/Exposure/value 1 msg : std_msgs/Float32
/device_0/sensor_0/option/Frames Queue Size/description 1 msg : std_msgs/String
/device_0/sensor_0/option/Frames Queue Size/value 1 msg : std_msgs/Float32
/device_0/sensor_0/option/Gain/description 1 msg : std_msgs/String
/device_0/sensor_0/option/Gain/value 1 msg : std_msgs/Float32
/device_0/sensor_0/option/Inter Cam Sync Mode/description 1 msg : std_msgs/String
/device_0/sensor_0/option/Inter Cam Sync Mode/value 1 msg : std_msgs/Float32
/device_0/sensor_0/option/Laser Power/description 1 msg : std_msgs/String
/device_0/sensor_0/option/Laser Power/value 1 msg : std_msgs/Float32
/device_0/sensor_0/option/Output Trigger Enabled/description 1 msg : std_msgs/String
/device_0/sensor_0/option/Output Trigger Enabled/value 1 msg : std_msgs/Float32
/device_0/sensor_0/option/Stereo Baseline/description 1 msg : std_msgs/String ...
Does
rosbag info <YOUR_BAG_FILE>
help? You will see the number of messages in each topic. I'm not familiar withrs-convert
, but if this is only converting each message of a single topic, this should be sufficient.@Abraham, you can use rostopic hz <image_topic> to find the rate at which it is being published. This applies while both recording and playing back a rosback. Usually rate of publishing and rate of recording are same in ROS
@mgruhler, I have added the output of
rosbag info <BAG_FILE>
in my question. I am not sure if this helps me.@BV_Pradeep, I still do not completely understand how ROSBAG works, and I am not able to run
rostopic hz <image_topic>
as I cannot playback the BAG file withrosbag play
, I am getting errors about localhost and such.