ros2/rosbag2

How to save an Intel RealSense D435 capture using ROS2 humble in a .bag file in mp4 format?

monajalal opened this issue · 1 comments

Description

I want to save the capture in .mp4 format for use in upstream app. I am able to view the feed in RVIZ and record the capture in bag files.

Expected Behavior

** clear and concise description of what you expected to happen **

Actual Behavior

** clear and concise description of what actually happened. include copied logs whenever possible **

To Reproduce

** Steps to reproduce the behavior, e.g.

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. Logs print error '...' **

System (please complete the following information)

  • OS: Ubuntu 22.04 Jammy
  • ROS 2 Distro: Humble
  • Install Method: APT
  • Version: [release, branch, commit hash, patch release number]

Additional context

** Add any other context about the problem here **

(base) mona@mona-ThinkStation-P7:~/realsense-ros$ ros2 bag record -a
2023-10-24 15:31:27.067 [RTPS_TRANSPORT_SHM Error] Failed init_port fastrtps_port7417: open_and_lock_file failed -> Function open_port_internal
[INFO] [1698175887.078891824] [rosbag2_recorder]: Press SPACE for pausing/resuming
[INFO] [1698175887.080581927] [rosbag2_storage]: Opened database 'rosbag2_2023_10_24-15_31_27/rosbag2_2023_10_24-15_31_27_0.db3' for READ_WRITE.
[INFO] [1698175887.081582715] [rosbag2_recorder]: Listening for topics...
[INFO] [1698175887.081620349] [rosbag2_recorder]: Event publisher thread: Starting
[INFO] [1698175887.083172945] [rosbag2_recorder]: Subscribed to topic '/rosout'
[INFO] [1698175887.083883528] [rosbag2_recorder]: Subscribed to topic '/parameter_events'
[INFO] [1698175887.085310809] [rosbag2_recorder]: Subscribed to topic '/initialpose'
[INFO] [1698175887.086000091] [rosbag2_recorder]: Subscribed to topic '/goal_pose'
[INFO] [1698175887.086516674] [rosbag2_recorder]: Subscribed to topic '/events/write_split'
[INFO] [1698175887.087021693] [rosbag2_recorder]: Subscribed to topic '/clicked_point'
[INFO] [1698175887.087135670] [rosbag2_recorder]: Recording...
[INFO] [1698175888.098073631] [rosbag2_recorder]: Subscribed to topic '/camera/camera/infra1/camera_info'
[INFO] [1698175888.098993595] [rosbag2_recorder]: Subscribed to topic '/camera/camera/color/camera_info'
[INFO] [1698175888.100210654] [rosbag2_recorder]: Subscribed to topic '/camera/camera/extrinsics/depth_to_infra1'
[INFO] [1698175888.101016168] [rosbag2_recorder]: Subscribed to topic '/camera/camera/extrinsics/depth_to_depth'
[INFO] [1698175888.102269815] [rosbag2_recorder]: Subscribed to topic '/camera/camera/infra2/image_rect_raw'
[INFO] [1698175888.103011224] [rosbag2_recorder]: Subscribed to topic '/camera/camera/color/image_raw'
[INFO] [1698175888.103726223] [rosbag2_recorder]: Subscribed to topic '/camera/camera/extrinsics/depth_to_infra2'
[INFO] [1698175888.105131418] [rosbag2_recorder]: Subscribed to topic '/tf_static'
[INFO] [1698175888.105814924] [rosbag2_recorder]: Subscribed to topic '/camera/camera/color/metadata'
[INFO] [1698175888.106507153] [rosbag2_recorder]: Subscribed to topic '/camera/camera/depth/image_rect_raw'
[INFO] [1698175888.107098512] [rosbag2_recorder]: Subscribed to topic '/camera/camera/infra2/metadata'
[INFO] [1698175888.107652084] [rosbag2_recorder]: Subscribed to topic '/camera/camera/infra2/camera_info'
[INFO] [1698175888.108310735] [rosbag2_recorder]: Subscribed to topic '/camera/camera/depth/camera_info'
[INFO] [1698175888.108822687] [rosbag2_recorder]: Subscribed to topic '/camera/camera/infra1/metadata'
[INFO] [1698175888.109590832] [rosbag2_recorder]: Subscribed to topic '/camera/camera/depth/metadata'
[INFO] [1698175888.110120543] [rosbag2_recorder]: Subscribed to topic '/camera/camera/infra1/image_rect_raw'
[INFO] [1698175888.110656426] [rosbag2_recorder]: Subscribed to topic '/camera/camera/extrinsics/depth_to_color'
[INFO] [1698176112.322939531] [rosbag2_cpp]: Writing remaining messages from cache to the bag. It may take a while
[INFO] [1698176112.325282159] [rosbag2_recorder]: Event publisher thread: Exiting
[INFO] [1698176112.325686133] [rosbag2_recorder]: Recording stopped
[INFO] [1698176112.333185738] [rosbag2_recorder]: Recording stopped

and

(base) mona@mona-ThinkStation-P7:~/realsense-ros/rosbag2_2023_10_24-15_31_27$ ls
total 6.8G
drwxrwxr-x 12 mona mona 4.0K Oct 24 15:31 ..
-rw-r--r--  1 mona mona 6.8G Oct 24 15:35 rosbag2_2023_10_24-15_31_27_0.db3
drwxrwxr-x  2 mona mona 4.0K Oct 24 15:35 .
-rw-rw-r--  1 mona mona  15K Oct 24 15:35 metadata.yaml

and

(base) mona@mona-ThinkStation-P7:~/realsense-ros$ ros2 bag play  rosbag2_2023_10_24-15_31_27/rosbag2_2023_10_24-15_31_27_0.db3  --topics /camera/camera/color/image_raw
2023-10-24 15:37:13.061 [RTPS_TRANSPORT_SHM Error] Failed init_port fastrtps_port7417: open_and_lock_file failed -> Function open_port_internal

closing.

closing.
[INFO] [1698176233.069976756] [rosbag2_storage]: Opened database 'rosbag2_2023_10_24-15_31_27/rosbag2_2023_10_24-15_31_27_0.db3' for READ_ONLY.
[INFO] [1698176233.120592540] [rosbag2_player]: Set rate to 1
[INFO] [1698176233.123598009] [rosbag2_player]: Adding keyboard callbacks.
[INFO] [1698176233.123629086] [rosbag2_player]: Press SPACE for Pause/Resume
[INFO] [1698176233.123636591] [rosbag2_player]: Press CURSOR_RIGHT for Play Next Message
[INFO] [1698176233.123642857] [rosbag2_player]: Press CURSOR_UP for Increase Rate 10%
[INFO] [1698176233.123648335] [rosbag2_player]: Press CURSOR_DOWN for Decrease Rate 10%

closing.

closing.
[INFO] [1698176233.124033920] [rosbag2_storage]: Opened database 'rosbag2_2023_10_24-15_31_27/rosbag2_2023_10_24-15_31_27_0.db3' for READ_ONLY.

Here, I read that rosbag2video package/git repo only works for foxy. So what is the solution for humble?

Hi @monajalal I don't see any bugs or abnormal behavior in the rosbag2 from your description.
This type of question would be better asked at https://robotics.stackexchange.com
I briefly googled about rosbag2video and found this fork https://github.com/mlaiacker/rosbag2video which seems support Humble.
Give it a try.