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

video_recorder is not saving correctly

asked 2020-07-07 15:11:21 -0500

blaine141 gravatar image

I am trying to take the contents of a bag file and record them to a video file using the following launch file. The result is always an output.avi file that is 4.1kB and is not able to be played. Any advice?

<launch>
<arg name="namespace" default="puddles" />
<arg name="bag_file" default="/home/blaine/ros/bringup_2020-07-05-16-23-28.bag" />
<arg name="topic" default="darknet_ros/image_hud" />

<group ns="$(arg namespace)">
    <node pkg="rosbag" type="play" name="rosbag" args="$(arg bag_file)"/>
    <node pkg="image_transport" type="republish" name="republish" args="compressed in:=$(arg topic) raw out:=$(arg topic)">
        <param name="in" value="$(arg topic)/compressed" />
        <param name="out" value="$(arg topic)" />
    </node>
    <node pkg="image_view" type="video_recorder" name="video_recorder" output="screen">
        <remap from="image" to="$(arg topic)"/>
        <param name="filename" value="../output.avi" />
    </node>
</group>
</launch>
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2020-07-08 16:03:47 -0500

blaine141 gravatar image

Turns out it was because my image topic did not have a timestamp. Video_recorder checks the timestamp for frame rate limiting and all my times were 0. Time to fix my camera driver! :)

edit flag offensive delete link more

Comments

@blaine141 How did you manage to add timestamps to your image topic? I have exactly the same problem with "video_recorder" and I think my problem is same with yours, timestamps.

alperenkeser gravatar image alperenkeser  ( 2023-03-29 03:48:08 -0500 )edit
1

@alperenkeser Most camera drivers add a timestamp to the camera feed. If I remember correctly I had a node that took in the camera feed, drew on the images, and then output to another camera feed. I just forgot to copy over the timestamp. If you do not have timestamps on your image messages, I would look at your camera driver or whatever is publishing the image messages

blaine141 gravatar image blaine141  ( 2023-03-29 20:40:25 -0500 )edit

@blaine141 Thanks for the reply. Here is the problem, I republish an Image topic again, after changing its format. But as expected, this republished topic does not have a camera_info topic so I created (published) one myself by following the answer in this question: https://answers.ros.org/question/2438...

Does the answer in above link use timestamps in its /camera_info? Because I did the exact same thing and I don't think I have them. I am not sure what I am doing wrong.

alperenkeser gravatar image alperenkeser  ( 2023-03-30 01:08:48 -0500 )edit
1

The problem is when you republish the image message. Your image message needs to have the timestamp in the header set. Copy from the original message when you are republishing

blaine141 gravatar image blaine141  ( 2023-03-30 01:40:01 -0500 )edit
blaine141 gravatar image blaine141  ( 2023-03-30 01:40:23 -0500 )edit

@blaine141 That did it! Thank you very much.

alperenkeser gravatar image alperenkeser  ( 2023-03-30 06:11:20 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2020-07-07 15:11:21 -0500

Seen: 369 times

Last updated: Jul 08 '20