DOC Skip to main content

C++ Sample Recorder

Update on 2025-07-25 07:47:40

Function description: Connect the device to start streaming, record the current video stream to a file, and exit the program with the ESC_KEY key

| This example is based on the C++High Level API for demonstration

Firstly, it is necessary to create a pipeline, through which multiple types of streams can be easily opened and closed, and a set of frame data can be obtained

ob::Pipeline pipe;

Get the stream configuration of the depth camera

depthProfile = std::const_pointer_cast<ob::StreamProfile>(profiles->getProfile(OB_PROFILE_DEFAULT))->as<ob::VideoStreamProfile>();

Configure which streams to enable or disable in the Pipeline by creating a Configuration, where depth streams will be enabled

// Configure the stream types opened by Pipeline
std::shared_ptr<ob::Config> config = std::make_shared<ob::Config>();
config->enableStream(depthProfile);

Start the stream configured in Configuration. If no parameters are passed, the default configuration start stream will be activated, and the recording switch will be activated

pipe.start(config);
pipe.startRecord("./OrbbecPipeline.bag");

Wait for a frame of data in a blocking manner, which is a composite frame containing frame data for all streams enabled in the configuration, and set the waiting timeout time for the frame

auto frameSet = pipe.waitForFrames(100);	// Set the waiting time to 100ms

Stop Pipeline, no more frame data will be generated

pipe.stop();

 

ON THIS PAGE

Add

  • Name:

  • Link Address:

Cancel

Add

  • Name:

  • Link Address:

Cancel
Questions or
Feedback?

Feedback

  • Your feedback matters! Share your thoughts on this page, report errors, or let us know how we can improve to better support your needs. If applicable, please include the specific sentence or section to help us identify and address the issue.