mlaiacker / rosbag2video

converts image sequence in ros bag files to video files
GNU General Public License v2.0
313 stars 111 forks source link

Update Readme To Make the Features of the Package Explicit. ros2bag2video.py only works with compressed image stream #37

Open hakunaMatataHub opened 10 months ago

hakunaMatataHub commented 10 months ago

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
cardboardcode commented 1 month ago

@hakunaMatataHub May I get your help to provide an example of a ROS 2 bag with compressed images and one without so I can reproduce the issue better?