How can I synchronize the topics of a rosbag with a video?
I have a video file(the source). I also have a rosbag file with some topics (including a processed compressed video) that were created from this (source) video file.
I would like to create a python script where I read the video and at the same time (through a launch file) I receive the topics from the rosbag and I send all of this as published topics (so that I can visualize it to rviz)
The launch file would be something like (I am not sure yet if it is correct)
<launch>
<node name="rosbag" type="play" pkg="rosbag" args="$(find post_process_tool)/bags/mybaffile01.bag" >
</node>
<node name="republish" type="republish" pkg="image_transport"
output="screen"
args="compressed in:=/object_image/
raw out:=/object_image/" />
<node name="processor" pkg="post_process_tool" type="ros_process_video.py"
output="screen">
<param name="videofile" value="$(find post_process_tool)/videos/originalvideo.h264"/>
</node>
<node type="rviz" name="rviz" pkg="rviz" args="-d $(find post_process_tool)/rviz/post_process2.rviz" />
</launch>
My question is how can I synchronize the reading of the video frames with the rosbag video topic so that they are visualized at the same pace?