ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Frames dropped during video recording?

asked 2019-09-12 13:23:45 -0600

Abraham gravatar image

I have done several recordings using the Intel® RealSense™ Depth Camera D435 (https://www.intelrealsense.com/depth-...).

I checked the BAG files using rosbag info, and got the number of frames from the number of "messages" for the /device_0/sensor_1/Color_0/image/data topic. Also, I know the duration of the video from rosbag info as well.

Is this the right process for checking if frames were dropped during recording? I know the D435 camera should be recording at 30 fps, so I multiplied the duration by 30 to get the number of expected frames. Then I subtract the number of "messages" from that to get the number of frames dropped.

For example, I have pasted an example output from rosbag info below. The number of "messages" is 20882. The duration is 699s. So the number of frames dropped is (699s x 30fps) - 20882 = 88 frames dropped.

Can anybody confirm this is correct?

Wed Sep 11 16:33:18 EDT 2019
path:         <BAG_FILENAME>
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          
              /device_0/sensor_0/option/Stereo Baseline/value                        1 msg     : std_msgs/Float32         
              /device_0/sensor_0/option/Visual Preset/description                    1 msg     : std_msgs/String          
              /device_0/sensor_0 ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2019-09-12 16:26:21 -0600

tfoote gravatar image

Sure, that's a measurement of frames dropped to some extent. Depending on what you're trying to measure that could be a useful measure or not. If you're that close it's likely you got all the messages during the recording but had some missed at startup and shutdown of the recording.

Depending on your setup the messages arriving from different sources might start and end at different times as it takes some time to establish connections at startup, and exactly how the system shutdown there might also be extra time at the end from other topics too.

I'll note that you're using a rounded length of the bag file, the more precise length of your bag listed is 699.81s which is several more frames equivalent. You could also look at the actual timestamps of the first and last logged camera images to detect losses in the stream.

If you want to be more accurate you can write a script to look at the timestamps and find out potentially not just how many were lost but which frames were lost if any during the stream.

You need to evaluate whether the metric you're using is valid for whatever use case you're planning to use the metric for.

edit flag offensive delete link more

Comments

You could use the rqt_bag utility to quickly check if there are gaps in the messages at startup and shutdown.

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2019-09-13 04:55:53 -0600 )edit

For some other BAG files, following the same measurement and calculation, I am getting as many as 10,000 frames being dropped...

Abraham gravatar image Abraham  ( 2019-09-13 14:58:44 -0600 )edit

I m getting a similar behaviors for the D435i, doing the frame-rate calculation on bagfiles @30fps, since data starts to come in I get variations between 24FPS and 30 FPS in ~20sec long sequences. Where you able to figure out why does this happen.

l_vis gravatar image l_vis  ( 2020-02-11 11:34:40 -0600 )edit

@l_vis , I was using the RealSense Viewer software, and I changed the compression settings on the RealSense Viewer software (from Device Default to Never Compress), and that seemed to help! Evidently, this means that the files took up a LOT more space... For my situation, it was more important to have all the frames, and that outweighed the cost of having huge files...

Abraham gravatar image Abraham  ( 2020-02-11 11:54:21 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2019-09-12 13:23:45 -0600

Seen: 1,470 times

Last updated: Sep 12 '19