Quickstart
Build the SDK, start a recording, query state, stop and collect the files.
Quick start
1. Build
cmake -S the Linux recording SDK -B build/linux-recording -DCMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build build/linux-recording --parallel 2
ctest --test-dir build/linux-recording --output-on-failureOn Windows, use the build script shipped with the SDK (CXX selects the compiler).
2. Record a real MP4 (legacy IRecordingEngine)
MyHandler handler;
agora::IRecordingEngine* engine = agora::IRecordingEngine::createAgoraRecordingEngine("app-id", &handler);
auto* concrete = static_cast<nimeet::recording::RecordingEngine*>(engine);
agora::RecordingConfig config{};
config.recordFileRootDir = const_cast<char*>("./recordings");
config.mixResolution = const_cast<char*>("640,360,15");
if (engine->joinChannel(token, "channel-1", 1001, config) != 0) return 1;
concrete->SetFrameSource(std::make_shared<nimeet::recording::SyntheticFrameSource>(640, 360, 15));
concrete->PumpFrames(150); // 10 seconds at 15 fps
if (engine->leaveChannel() != 0) return 2; // output failed verification; onError was raised
const auto& output = concrete->output(); // verified=true, container="mp4", duration>0
engine->release();3. The 4.x surface (IAgoraMediaRtcRecorder)
agora::IAgoraService* service = agora::createAgoraService();
agora::AgoraServiceConfiguration serviceConfig{};
serviceConfig.appId = const_cast<char*>("app-id");
serviceConfig.enableAudioDevice = false; // the recorder has no audio device
service->initialize(serviceConfig);
agora_refptr factoryReference = agora::createAgoraMediaComponentFactory();
auto* factory = static_cast<agora::IAgoraMediaComponentFactory*>(factoryReference.raw());
agora::IAgoraMediaRtcRecorder* recorder =
static_cast<agora::IAgoraMediaRtcRecorder*>(factory->createMediaRtcRecorder().raw());
recorder->initialize(service, /*enable_mix=*/true, /*recordEncodedOnly=*/false);
recorder->registerRecorderEventHandle(&handler); // IAgoraMediaRtcRecorderEventHandler
recorder->joinChannel(token, "channel-1", "recorder");
recorder->startRecording();
// ... push frames or use the egress sink ...
recorder->stopRecording();
recorder->leaveChannel();4. Verify the output
ffprobe -v error -show_entries format=duration,size ./recordings/channel-1_1001.mp4The SDK performs the same verification internally (container header + byte count + ffprobe duration).