See 1.2 on this page. Here is a small example using the freenect_throttle.launch file in that tutorial:
# Recording raw images:
$ roslaunch freenect_throttle.launch rate:=10
$ rosbag record -O raw_images.bag /tf /camera/data_throttled_image /camera/data_throttled_image_depth /camera/data_throttled_camera_info
# Replaying with rtabmap:
$ roslaunch rtabmap_ros rtabmap.launch use_sim_time:=true rgb_topic:=/camera/data_throttled_image depth_topic:=/camera/data_throttled_image_depth camera_info_topic:=/camera/data_throttled_camera_info rtabmap_args:="--delete_db_on_start"
$ rosbag play --clock raw_images.bag
If you want to record compressed images to save some space:
# Recording compressed images:
$ roslaunch freenect_throttle.launch rate:=10
$ rosbag record -O compressed_images.bag /tf /camera/data_throttled_image/compressed /camera/data_throttled_image_depth/compressedDepth /camera/data_throttled_camera_info
# Replaying with rtabmap:
$ roslaunch rtabmap_ros rtabmap.launch use_sim_time:=true rgb_topic:=/camera/data_throttled_image depth_topic:=/camera/data_throttled_image_depth camera_info_topic:=/camera/data_throttled_camera_info compressed:=true rtabmap_args:="--delete_db_on_start"
$ rosbag play --clock compressed_images.bag
cheers,
Mathieu