rosbag compress is a command-line tool that is used for compressing bag files. Currently, there are two supported formats—BZ2 and LZ4. However, BZ2 is the default. We can get its uses and help by using the following command (refer to http://wiki.ros.org/rosbag/Commandline#compress for more information):
$ rosbag compress -h
And compress the given bag files using BZ2 as follows:
$ rosbag compress *.bag
Similarly, rosbag decompress is a command-line tool for decompressing bag files. Moreover, it automatically determines which compression format a bag uses. We can get the uses and help by using the -h option, as follows:
$ rosbag decompress -h
And decompress the given bag files using the following command:
$ rosbag decompress *.bag ...