ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

How to Extract video from bag file?

asked 2014-03-11 04:05:32 -0500

Leyonce gravatar image

updated 2014-03-13 11:58:45 -0500

Hi, I am using ROS hydro on Ubuntu 12.04. After using the command "rosrun image_view extract_images _sec_per_frame:=0.01 image:={IMAGE_TOPIC_IN_BAGFILE}" I'm having an error when executing"ffmpeg -r -b -i frame%04d.jpg .avi" The thing is I am not seeing the sequence of images after I play the bagfile.I ran "rosbag info" to obtain the topic in the bag file but when I run "rosrun rqtgraph rqtgraph" the /extract_image frame node is there all by itself.

When I follow the tutorials on I get an error " [FATAL] [1394583654.335465840]: Error opening file: play".After replacing play by "--clock" or just removing "play" everything seemed to go just fine but there are no frames*.jpg in /home/.ros. I feel like I'm lacking something.Can anyone help?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2014-03-14 05:08:15 -0500

Leyonce gravatar image

updated 2014-03-14 05:11:18 -0500

This was my image topic /front_camera/camera/image_raw/compressed. This is what i had to do: 1) In a directory in which is writable (~/catkin_ws/bagfiles) type in the terminal "rosrun image_view extract_images image:=/front_camera/camera/image_raw _image_transport:=compressed " 2) Then play the bagfile.(Though It can be done before or after) Then in the terminal in which rosrun was executed the following appears: "[ INFO] [1394806321.162974947]: Saved image frame0467.jpg" The frames were made in that directory. process completed.

edit flag offensive delete link more


i'm also facing the same problem, can u pls explain step 1.

pronik gravatar image pronik  ( 2014-03-16 09:35:23 -0500 )edit

pls help how to do it

pronik gravatar image pronik  ( 2014-03-16 11:42:18 -0500 )edit
<@amentor.Sorry">p>@amentor.Sorry I did not reply earlier.Well,"~/catkin_ws" is my catkin workspace i just placed my bagfiles in there because of reasons.rosrun allows me to run the node extract_image which is in the package image view, and i identify the bagfile using its topic gotten using rosbag info.

Leyonce gravatar image Leyonce  ( 2014-03-17 13:37:01 -0500 )edit

anyways I guess that depending on the image topic you'll have to do an image_transport.Hope that helps.

Leyonce gravatar image Leyonce  ( 2014-03-17 13:37:53 -0500 )edit

its not working for me. followed the same procedure, images are not being saved. the rostopic is same as your bag file.

pronik gravatar image pronik  ( 2014-03-17 19:10:58 -0500 )edit
<@amentor.In">p>@amentor.In which directory are you doing the rosrun?did i forget to mention that you need to play the bagfile after you perform the rosrun?please tell me exactly what you've done so i'll try it and maybe will I figure out what's wrong.

Leyonce gravatar image Leyonce  ( 2014-03-19 01:41:31 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-03-11 04:05:32 -0500

Seen: 2,146 times

Last updated: Mar 14 '14