How to convert video file to bag?

asked 2020-03-10 13:26:14 -0500

Cerin gravatar image

updated 2020-03-10 13:27:31 -0500

How do you convert a generic video file (e.g. avi or mjpeg) to bag format containing each video frame as a sensor_msgs/CompressedImage type on a specific topic, as though it were originally broadcast from a ROS camera node?

I want to test some monocular SLAM packages that only require the input of a single video feed, and instead of carting around an entire ROS computer plus camera setup, and because there's no ROS output or interaction required, it would be much easier to simply record video of someone walking through an environment separately, and then later feed that into the package. It would also allow me to create a standardized input and benchmark different algorithms.

I can find lots of examples through Google of converting video in bag files back into regular video files, but nothing about going the other way. This seems like a straight forward and common procedure, so I'd be surprised if there wasn't some pre-existing tool to do this.

edit retag flag offensive close merge delete

Comments

gvdhoorn gravatar image gvdhoorn  ( 2020-03-10 16:06:47 -0500 )edit