Closed cardboardcode closed 3 years ago
Hi, thanks for the message. I am happy that my (not so nice code) is helping. I am currently not working with ROS so it would be nice if you do the porting.
Thanks for the quick response. @mlaiacker
Noted. Then I get started working on a quick prototype and update my progress using this issue thread. :smile:
An experimental port of the rosbag2video.py
python script has been done and can be found under the new foxy
branch.
https://github.com/mlaiacker/rosbag2video/tree/foxy
The new script is called ros2bag2video.py
.
This port is still incomplete due to the dirty hacky nature of the port and the lack of a proper rosbag2 python API that allows us to read a ROS2 bag file fully programmatically. The API implementation will be in the rolling distribution, instead of ROS2 Foxy, as seen in this issue thread.
That being said, it still works for simple ROS2 bag files (at least the ones I have tested on my own). For now, it is able to read sensor_msgs/Image
ROS2 messages only and deal with bgr8
encoding.
pix_fmt
.avconv
, VIDEO_CONVERTER_TO_USE.~ (See comment below for reason behind striking this out.)Will continue working on this when I have the time.
.mp4
files.To verify the ported features to accomodate different ROS2 image message type,
please comment below to indicate if you can share it with me in order to do the testing.
Porting the use of avconv
is determined to be unnecessary based on my own understanding of the differences between avconv
and ffmpeg
.
Reference: https://superuser.com/a/507473
Libav or avconv
development activity has nearly ceased as of 13th December 2019. ffmpeg
will continue to be maintained with talks of Libav developers participating in FFmpeg once again, signalling a reintegration of Libav into FFmpeg.
Also, it is so much easier and intutive to use ffmpeg
instead, at least in my opinion.
I am fine with using ffmpeg
Python script ros2bag2video.py
has been adhered to PEP8 python linting standards.
It is verified to adhere by running the following pycodestyle
too and generating the following output:
pip3 install pycodestyle
pycodestyle --show-source ros2bag2video.py
# No output shown. No linting errors found.
pycodestyle
is the renamed pep8
linting python tool. Click here for more details.
Porting has been completed tentatively, to the best of my understanding of what a robust and readable python script ought to be.
For further testing and issues. Please submit as an issue and I will address them with the appropriate fixes. Thank you. :smile:
Hi @mlaiacker, thank you for providing this convenient tool. It has been helpful in converting ROS1 bags to
.mp4
videos. :smile: :+1:Question
Do you plan to port this script to ROS2 Foxy?
If none at the moment, I will be happy to take a look at porting the script myself and sharing it via a Pull Request.