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

video_recorder compressed image

asked 2016-09-16 09:51:11 -0600

fabbro gravatar image

updated 2016-09-16 10:22:45 -0600

Hi all,

I am trying to get a video from a compressed Image. I saved the data from the camera in a rosbag file called _2016-09-13-02-10-12.bag.

If I do :

rosbag info _2016-09-13-02-10-12.bag.

I get:

path:        _2016-09-13-02-10-12.bag
version:     2.0
duration:    5:10s (310s)
start:       Sep 13 2016 02:10:13.02 (1473725413.02)
end:         Sep 13 2016 02:15:23.30 (1473725723.30)
size:        1.3 GB
messages:    5380
compression: none [1520/1520 chunks]
types:       sensor_msgs/CompressedImage [8f7a12909da2c9d3332d540a0977563f]
topics:      /camera_2/image_raw/compressed   5380 msgs    : sensor_msgs/CompressedImage

So, I play the rosbag by:

rosbag play --pause _2016-09-13-02-10-12.bag

I try to record the video by:

rosrun image_view video_recorder image:="/camera_2/image_raw" _image_transport:="compressed"  _filename:="video.avi"  _max_depth_range:="0" _fps:="30" _codec:="I420"

But the result is that I get:

[ INFO] [1474033858.402189526]: Waiting for topic /camera_2/image_raw...

And every 10s I have something like:

[ WARN] [1474037302.946135179, 1473725424.251391530]: [image_transport] Topics '/camera_2/image_raw/compressed' and '/camera_2/camera_info' do not appear to be synchronized. In the last 10s:
    Image messages received:      153
    CameraInfo messages received: 0
    Synchronized pairs:           0

It doesn't do anything else If I do CTRL+C it tells me:

Video saved as video.avi

But there is no video saved.

I think the error is in the warning message.

Could you help me ?

Thanks.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-09-16 10:24:45 -0600

fabbro gravatar image

I found the solution. It was like I thought, the video_recorder needed the camera_info topic otherwise it can't sync the stuff. So I generated a fake camera_info (with the right height,width of the image).

Basically I needed to publish a camera_info topic.

I did it in this way:

rosrun topic_tools transform "/camera_2/image_raw/compressed" camera_2/camera_info sensor_msgs/CameraInfo "std_msgs.msg.Header(m.header.seq, m.header.stamp, ''), 1552, 2080, '', [0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], 0, 0, sensor_msgs.msg.RegionOfInterest(0,0,0,0,False)" --import rospy std_msgs sensor_msgs

I hope this will help someone else who will have the same problem.

Thanks.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-09-16 09:51:11 -0600

Seen: 1,485 times

Last updated: Sep 16 '16