How to exctract data IMU from .bag file
HI,
I was recording a video using realsense viewer.exe. The output of the file is .bag file. Th ecamera that i use is D435i.
i wish to collect the data from bag file:
1. video format that supported by windows (eg:mp4)
2. Data IMU in csv file (synchronise with video)
Any suggestion and direction that may help?
-
The RealSense SDK does not have a means of recording directly into a video file or converting a bag into a video. There are a couple of ways to get a video file indirectly though.
1.Use the RealSense SDK's rs-convert tool to extract the bag's frames as a set of PNG image files
https://github.com/IntelRealSense/librealsense/tree/master/tools/convert
You can then convert the PNG set into a video. Please google for 'convert png set to video' for details on how to do this.
The rs-convert tool can also convert a bag file to a CSV file. If you have the IMU streams active at the time of recording the bag then they should be included in the bag, and therefore the CSV too when the bag is converted.
Or 2. You could play the bag file in full-screen view whilst a screen capture program is running to record what is on screen as a video file. Examples of programs supporting Windows, Linux and Mac that can do this include:
ffmpeg
https://www.ffmpeg.org/download.html
Open Broadcaster Software (OBS)
-
Hi MartyG,
Thanks for the reply, I was trying the solution above:
1. I able to convert .bag file to png (frame by frame), but I can't see any online converter (png to mp4) with set fps for 30. Do you have any recommended webste or software?
2. I successfully run rs-convert.exe (bag to csv) in cmd, it show 100% convert, BUT no file is coming out. And an error log file is found.
Comment Line:
rs-convert.exe -v "C:\Users\JJ\Desktop\q" -i "C:\Program Files (x86)\Intel RealSense SDK 2.0\tools\20200316_174134.bag
(this success to produce png when i change "-v" to "-p")
Error Log:
WARNING [21564] (playback_device.cpp:198) Playback device does not provide a matcher

-
I can't guarantee the safety of online png to video conversion websites so use of them is at your own risk (the same as downloading a converter program from the internet). Google for 'online png to video converter' for links to converter sites. One such site is Kapwing.
https://www.kapwing.com/resources/convert-a-png-to-an-mp4/
https://www.youtube.com/watch?v=0Bop_Z7QvxE
Regarding the csv conversion: you could try using the following instruction, as I see the bag is already in the Tools folder where the rs-convert.exe executable is:
rs-convert.exe -v test -i 20200316_174134.bag
-
Hi,
May I know the directory of csv file will locate at the next of rs-convert.exe?
I tried the ran before and I ran again just now, it shown 100% csv convert but no additional file is generated.

As usual, an error log file also shown: [21580] (playback_device.cpp:198) Playback device does not provide a matcher

-
It seems that others have been experiencing this error. Unfortunately there is not a suggested fix yet.
https://github.com/IntelRealSense/librealsense/issues/4171
I will label that discussion with the "Bug" tag to draw the attention of the RealSense team to it.
-
Hi Jjaygan110,
I'm trying to get to the stage where I can convert my .bag file to csv using rs-convert.exe... can you please outline how you did this? Sorry, not a programmer here, just someone with a very specific need for tracking!
Please sign in to leave a comment.
Comments
8 comments