ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Hi Miguel,

This stems from the fact that we're semi-abusing the Theora format in ROS. It wasn't really designed for the full generality of things you can legally do when publishing ROS images, like publishing at variable rates, changing image resolution/encoding, etc. It works, but it's not a perfect fit.

In particular, when you publish your first image, theora_image_transport needs to just-in-time publish some header packets containing metadata about the image stream. Part of that metadata is the frame rate, which theora_image_transport doesn't know ahead of time. So it just makes up a number, and assumes FPS is 1. For normal ROS transport purposes, we process packets as they arrive and ignore the bogus FPS metadata.

Unfortunately, for ogg_saver this number does matter. ogg_saver basically just streams all the packets to disk, and video players end up using the bogus FPS number.

The simplest workaround is to directly edit the FPS value in theora_image_transport. Edit theora_publisher.cpp, find the line

encoder_setup_.fps_numerator = 1; // don't know the frame rate ahead of time

and hardcode to the value you need. Recompile, and you've increased the frame rate.

In principle, ogg_saver could do better. It could remember where fps_numerator is recorded near the start of the .ogv file, calculate the frame rate of the incoming stream, and then overwrite that value on exit. It's slightly messy and hasn't been a high priority for me yet. Patches welcome of course :)