daniilidis-group / ffmpeg_image_transport

image transport that uses libavcodec for compression
Apache License 2.0
42 stars 13 forks source link

Store in rosbag and beeing able to replay #5

Closed nullket closed 2 years ago

nullket commented 2 years ago

Hello,

to be able to deal with my available data rate I was very happy to stumble across this project! Using noetic your code works perfectly for live feeds. Well done!

But I am not able to store the images/video in a rosbag. Have you experience with that? My test was:

berndpfrommer commented 2 years ago

It's definitely possible to replay from a bag, but it's been a while since I've done that. I think the problem is that the rosbag player does not instantiate an image transport so you need to actually tell the client what transport you want to use, in this case "ffmpeg". Have a look at the answer here. https://answers.ros.org/question/129266/how-to-i-rosbagrecord-a-loosless-compressed-images/

My guess would be that in your case this would become [THIS IS WRONG, SEE BELOW FOR RIGHT ANSWER]:

rosrun image_view image_view image:=/camera/image_raw ffmpeg

Or maybe use as image "/camera/image_raw/ffmpeg". The important part is the last keyword which selects the transport. Also make sure that before you run the image_view, in that terminal the ffmpeg image transport plugin is visible (there's a way to list all available transport plugins in ros). Otherwise image_view cannot decode the ffmpeg packets.

nullket commented 2 years ago

Thanks for the quick answer! I had an urgent presentation so it took me a bit until I could check your proposal and play around with the plugin:

I was able to to record it in a bag as one would expect:

rosback record /camera/image_raw/ffmpeg

and replay it with:

rosrun image_view image_view image:=/camera/image_raw  _image_transport:=ffmpeg

So to sum it up: it is perfectly possible to store the topic in bags and replay them. Nonetheless, rqt_image_view does not work out of the box (even I specify _image_transport:=ffmpeg). Actually, that was the reason why I opened this issue, I initially just tried it with rqt_image_view. If you do not mind we could leave this issue open and I will check within the next weeks whats the matter with rqt_image_view and report back.

berndpfrommer commented 2 years ago

will leave open, thanks for testing!

nullket commented 2 years ago

I have done some further tests

Summing it up

TL:DR All works but it needs a local extension of rqt_image_view

berndpfrommer commented 2 years ago

Thanks for digging deep on this issue and the nice writeup! At some point I may rewrite this plugin for ROS2 and try to get (the ROS2 version of) the plugin into the official ROS repos. The dependency on a custom built ffmpeg would then have to be removed.