3 Replies Latest reply on Feb 11, 2018 6:53 AM by MartyG

    How to record video from D435 cameras

    jmagen

      Hi everyone,

       

      I'm new to both the D435 and RealSense SDK 2.0. I want to modify the rs-multicam c++ sample to synchronously record videos from each connected RGB camera, and to save the videos to a path.

      I'm not sure where to begin, and I would really appreciate your help.

       

      Thank you,

      jmagen

        • 1. Re: How to record video from D435 cameras
          MartyG

          Welcome to the RealSense community!

           

          The options for recording with a D435 currently include:

           

          1.  Recording data into a file called a 'rosbag.

           

          librealsense/readme.md at master · IntelRealSense/librealsense · GitHub

           

          If you are new to recording, you may like to first experiment with recording and playing back data in the pre-made RealSense Viewer tool that comes with the SDK 2.0, as described in the above link.

           

          A short YouTube video explaining the rosbag process is also available.

           

          rosbag - YouTube

           

          2.  The other option is to record the RealSense data into a PNG image with the SDK's 'Save-To-Disk' sampl eprogram.  You could then convert the PNG into a conventional video.  Google 'convert png to video' for more details.

           

          librealsense/examples/save-to-disk at master · IntelRealSense/librealsense · GitHub

          • 2. Re: How to record video from D435 cameras
            jmagen

            Thanks for the quick reply, MartyG.

             

            I very much like the playback of rosbag files within the RealSense viewer, so I would like to replicate that. I'm trying to add some recorders into the multicam sample, but I'm having a hard time creating a recorder for a stream.

             

            Immediately after multicam's query for the list of connected RealSense devices, I inserted a query for all sensors in the context--with the hope that I could find the color streams and create a recorder for each of them.

            Here is my code snippet:

            for (auto&& sen : ctx.query_all_sensors()) { // Query the list of sensors
                 for (auto&& prof : sen.get_stream_profiles()) { // Query the list of stream profiles from sen
                           if (prof.stream_type() == RS2_STREAM_COLOR) {
                                rs2::recorder rec("stream_name.bag", sen); //This does not work
                                connected_devices.enable_device(rec);
                      }
                 }
            }
            

             

            How should I go about creating a recorder for streams?

             

            Thanks again,

            jmagen

            • 3. Re: How to record video from D435 cameras
              MartyG

              The first thing I would try is to change rs2::recorder rec to rs2::recorder device

               

              The rationale behind this is that rs2::recorder device, followed by an instruction such as 'pause or 'filename'', seems to be the commonly occurring structure for rs2::recorder commands.