Ask Your Question
0

Export .bag to .jpeg / .mp4 tutorial not outputting anything

asked 2020-09-15 11:36:52 -0500

mhudne11 gravatar image

I am trying to convert a .bag file to .mp4 by following this tutorial: How to export image and video data from a bag file

I did the following steps:

  1. Ran: roscd image_view && rosmake image_view && sudo apt-get install mjpegtools
  2. Created an export.launch file containing the code from the tutorial (file placed in /opt/ros/melodic/share/image_view)
  3. Placed test.bag in /opt/ros/melodic/share/image_view
  4. Ran roslaunch export.launch

After running the command roslaunch export.launch, there are no .jpeg files in the ~/.ros directory like the tutorial says there should be.

The output of the roslaunch command is:

ThinkCentre-M90n-1:/opt/ros/melodic/share/image_view $ roslaunch export.launch
... logging to /home/max/.ros/log/801ba47c-f76e-11ea-b576-4074e0bec8b4/roslaunch-max-ThinkCentre-M90n-1-12751.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://max-ThinkCentre-M90n-1:33177/

SUMMARY
========

PARAMETERS
 * /rosdistro: melodic
 * /rosversion: 1.14.9

NODES
  /
    extract (image_view/extract_images)
    rosbag (rosbag/play)

auto-starting new master
process[master]: started with pid [12761]
ROS_MASTER_URI=http://localhost:11311

setting /run_id to 801ba47c-f76e-11ea-b576-4074e0bec8b4
process[rosout-1]: started with pid [12774]
started core service [/rosout]
process[rosbag-2]: started with pid [12780]
process[extract-3]: started with pid [12782]
[ INFO] [1600186456.400606637]: Initialized sec per frame to 0.100000
================================================================================REQUIRED process [rosbag-2] has died!
process has finished cleanly
log file: /home/max/.ros/log/801ba47c-f76e-11ea-b576-4074e0bec8b4/rosbag-2*.log
Initiating shutdown!
================================================================================
[extract-3] killing on exit
[rosbag-2] killing on exit
[rosout-1] killing on exit
[master] killing on exit
shutting down processing monitor...
... shutting down processing monitor complete
done

The log file contains:

[ INFO] [1600186456.311782786]: Opening /opt/ros/melodic/share/image_view/test_mask.bag

Waiting 0.2 seconds after advertising topics... done.

Hit space to toggle paused, or 's' to step.
 [RUNNING]  Bag Time:     34.406766   Duration: 34.406766 / 34.439933               6456.59 
Done.

Does anyone know what's wrong? I am new to ROS (using melodic), am just using it to try to convert a .bag file I recorded on an Intel Realsense camera to .mp4.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2020-09-15 22:27:05 -0500

Josh Whitley gravatar image

It looks like there are several problems here:

  1. The contents of this tutorial are _incredibly_ old. The rosmake command hasn't been used since before kinetic, which will be EOL next year.
  2. You should be creating your files in a ROS workspace in your home directory instead of trying to make changes to /opt/ros which is where binary packages are installed. See this page for more information about workspaces.
  3. For some reason, the launch file assumes that your rosbag will be in /opt/ros as well. For the reasons stated in 2, you should have it elsewhere (like your workspace) and replace the path $(find image_view)/test.bag with the full path to the rosbag.
  4. Based on the code in image_view/extract_images, the node will drop the images in the folder in which you run the launch file, not ~/.ros. This is why it is important to run the launch file somewhere that your user has write access to (like your home folder).

You should install the image_view package instead of building it from source. There is no need to build it from source as binaries exist for all current ROS versions. If you're using Ubuntu, the package name is ros-melodic-image-view. Once it's installed, source /opt/ros/melodic/setup.bash and your launch file should work.

edit flag offensive delete link more

Comments

Thank you for the clear explanation. By installing image_view, sourcing that bash file and using a different workspace, it worked! I also realized that I had to replace the topic in export.launch, i was able to find a list of topics in the .bag file with rostopic -b test_mask.bag. There were many topics, but the one which sounded the most reasonable was /device_0/sensor_1/Color_0/image/data.

The only issue I have now is the extracted number of frames was much less than expected (it output 295 when the .bag file contains ~1100). Do you know what might cause it to skip frames?

mhudne11 gravatar image mhudne11  ( 2020-09-16 11:30:08 -0500 )edit
1

Sorry, not sure what's causing that. Might want to check the rate at which the images are being produced from the bag file and how the saver is imlemented in extract_images.

Josh Whitley gravatar image Josh Whitley  ( 2020-09-16 15:49:59 -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

Stats

Asked: 2020-09-15 11:27:19 -0500

Seen: 457 times

Last updated: Sep 15 '20