pyralsense2.config.enable_device_from_file cropped .bag file
We recorded videos with two Intel RealSense L515 LiDAR Cameras with color frames arriving at 30 fps and depth and infrared frames at 3 mps to avoid interference. Because the size of the .bag files increases rapidly, we tried to remove the color frames that did not arrive immediately after a depth or infrared frame. The script is based on an example of creating a cropped bag file in the rosbag cookbook:
import rosbag import os, shutil ... orig = file.replace('.bag','.old') shutil.move(file, orig) with rosbag.Bag(file,'w') as outbag: with rosbag.Bag(orig,'r') as inbag: for topic, msg, t in inbag.read_messages(): # Save messages with image data depth frames if topic == '/device_0/sensor_0/Depth_0/image/data': outbag.write(topic, msg, t) ... os.remove(orig)
After running this script, the new .bag file cannot be opened with the rs-convert.exe tool or with pyralsense2.config.enable_device_from_file('file.bag') anymore. However, it can be opened using the 'Load Recorded Sequence' function of the Intel RealSense Viewer.
When the script writes each message with outbag.write (not removing color frames or color metadata), the new .bag file will be the same size, but it won't open either. We also tried using threading Lock acquire-release around all bag writes, but it gave the same result.
Does anyone know what the problem is with the cropped .bag files and why the Intel RealSense Viewer can open them but the rs-convert.exe tool and pyralsense2.config.enable_device_from_file('file.bag') cannot? How can we fix the recorded files or otherwise prevent this from happening in the future?
Hello M H E Straathof,
Thank you for contacting us.
If you are using Windows, the rs-convert program needs to be run from the Command Prompt interface of Windows instead of with a double-leftclick from the SDK's Tools folder. You can find the Command Prompt by typing 'command' into the text box at the bottom of the Windows screen.
You may find the discussion in the link below useful:
Please sign in to leave a comment.