Extracting video with audio from rosbags
I am trying to extract video from rosbags with audio. This turns out to be non-trivial, I haven't found any tools that just do this. Does anyone have pointers on how to go about getting video with audio out of rosbags? My thinking so far:
There are two challenges:
- There are no tools to extract audio and video together, so getting them in sync is tough
- Some tools assume a constant frame rate, which is a bad assumption with our cameras
There are a two possible approaches:
- Extract the video and audio separately. Inspect the bag to find the offset of starts for each one and account for that.
- Try to write the video with audio directly from the bags.
A few possible tools:
- kinesis video encoder: Takes the video from a topic stream and records it with a correct frame rate. Requires replaying the rosbags, can't just seek through them looking for messages
- ros-gst-bridge: Takes audio and video topics from ROS2 and puts them into a g-streamer pipeline. This would make it all work, I think. But this has the downside of running on ROS2. Looks like the audio message type is different too. Also requires playing the rosbags
- ros-audio-convert: converts audio topic in a bag file into an mp3 or wav file.
- rosbag to images: can extract frames from rosbag and put into video container. But then there is no attempt at getting timing correct.
- bag2video: converts rosbag topic to video supporting variable frame rates with repeated frames.