I am running Master branch with ros2 foxy, and trying to convert a color stream (image_raw) to mp4. Apparently this script only works for compressed images out of the box, you can modify the 'img = self.bridge.compressed_imgmsg_to_cv2(msg, self.msg_fmt)' to ' img = self.bridge.imgmsg_to_cv2(msg, self.msg_fmt)' in listner_callback function in the ros2bag2video.py executable. I further commented out the some code in the _playback_ros_bag function to make it compatible for non-compressed image stream, here is how it looks
def _playback_ros_bag(self):
print("Starting ROS bag playback...")
process = subprocess.Popen(
[
"ros2",
"bag",
"play",
self.bag_file,
# "-r",
# str(self.rate),
# "--topics",
# # HACK AJB Use this for SkateBot
# # "/camera_node/image_raw/compressed",
# # HACK AJB Use this for joeys.
# "/je7c/camera/compressed",
]
)
return process
P.S this will work for ros2 image_raw non compressed streams but it breaks the capability to set rate, and topic name by passing arguments to the script from cmd line. For my use case I was cool with the original fps and my bag had only one stream
I am running Master branch with ros2 foxy, and trying to convert a color stream (image_raw) to mp4. Apparently this script only works for compressed images out of the box, you can modify the 'img = self.bridge.compressed_imgmsg_to_cv2(msg, self.msg_fmt)' to ' img = self.bridge.imgmsg_to_cv2(msg, self.msg_fmt)' in listner_callback function in the ros2bag2video.py executable. I further commented out the some code in the _playback_ros_bag function to make it compatible for non-compressed image stream, here is how it looks