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

Import movie file (MPEG/AVI/MOV) into rosbag

asked 2011-04-11 02:26:42 -0500

mjcarroll gravatar image

Is there any way to import an MPEG movie file into a rosbag format?

I have some video recorded off of an HD digital camera that I want to do various processing on (camera calibration and ar_pose), but I'm not sure how to get it into a format that I can use in ROS.

edit retag flag offensive close merge delete



I have the same problem, could you help me how to convert a movie file into a rosbag?

thank you very much

karim02 gravatar image karim02  ( 2015-01-20 04:13:59 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2011-04-12 00:48:30 -0500

KoenBuys gravatar image

updated 2011-04-12 18:44:25 -0500

I'll post my code for this tomorrow on my git, I can't push from out of my office. The only thing I still need to add the camera info from xml file and a better way to compute the timestamp, suggestions are welcome.

I've pushed it to : KU Leuven OpenCV Git

edit flag offensive delete link more


Thanks! This looks like what I needed. I'll try it out and let you know.
mjcarroll gravatar image mjcarroll  ( 2011-04-13 04:09:20 -0500 )edit

'I tired your code with some avi files, but with non works, i get: ./bin/video_to_bag v1.bag ~/Desktop/v2.avi INFO: usage = video_to_bag <bagname> <videoname> INFO: starting conversion INFO: got fps of: 25, or 0.040000 incrementation ERROR: Could not grab a frame, perhaps we're at the end of the movie' What could be the problem? I can play the movies with a software.

zweistein gravatar image zweistein  ( 2013-11-04 11:42:52 -0500 )edit

answered 2011-04-11 13:41:37 -0500

William gravatar image

I could not find a "tool" to do this, but you can easily read frames from a video file into opencv:

And then you can use the image_transport package in ROS to output them onto a topic for processing:

Or you could use the python/c++ bagfile interface with opencv to write the frames of the video to the bag file directly.

gl hf

edit flag offensive delete link more


Is it fair to upvote you if you are working on the same project as me?
mjcarroll gravatar image mjcarroll  ( 2011-04-11 14:25:38 -0500 )edit

Question Tools


Asked: 2011-04-11 02:26:42 -0500

Seen: 2,742 times

Last updated: Apr 12 '11