This page demonstrates how to record a call by using the command line. You can also record calls by calling the API methods. For the detailed API reference, see Recording API. The command line and API methods implement the same recording functions.
Ensure that you integrate the On-premise Recording SDK before proceeding, see Integrate the SDK.
The On-premise Recording SDK joining a channel is equivalent to a dummy client joining a channel. The On-premise Recording SDK needs to join the same channel and use the same App ID and channel profile as the Agora Native/Web SDK.
Compile the sample code
Open a command-line tool and run the following command to compile the sample code under the samples/cpp directory.
After the compilation, an executable record_local file is generated in this directory as shown in the following figure.
Open a command-line tool and run the following command under the samples/cpp directory.
./recorder_local --appId <your App ID> --channel <channel name> --uid 0 --channelProfile <0 Communication, 1 Live broadcast> --appliteDir Agora_Recording_SDK_for_Linux_FULL/bin
channelProfilemust be the same as the Agora Native/Web SDK.
appliteDirmust be the path to the
Set recording options
Apart from the parameters in the above example, the demo provides other parameters and options. Run
./recorder_local to view all the parameters and options.
appliteDirparameters are mandatory to start a recording. Other parameters can be set as needed.
|appId||The App ID must be the same as the Agora Native/Web SDK. For details, see Getting an App ID.|
|uid||User ID. A 32-bit unsigned integer ranging from 1 to (232-1） that is unique in a channel. If the uid is set as 0, the SDK assigns a uid.|
|channel||Name of the channel to be recorded.|
|appliteDir||The directory of
|channelKey||Users with higher security requirements can use a token or Channel Key. For details, see Use Security Keys.|
|channelProfile||Sets the channel profile:
The On-premise Recording SDK must use the same channel profile as the Agora Native/Web SDK. Otherwise, issues may occur.
|isMixingEnabled||Sets whether or not to enable the audio- or video-composite mode.
|mixResolution||If you set
|mixedVideoAudio||If you set
For the supported players, see MIXED_AV_CODEC_TYPE.
|decryptionMode||When the whole channel is encrypted, the On-premise Recording SDK uses
|secret||The decryption password when decryption mode is enabled.|
|idle||The Agora On-premise Recording SDK automatically stops recording when there is no user in the recording channel after a time period set by this parameter. The value must be greater than three seconds. The default value is 300 seconds.
The idle time is also charged.
|recordFileRootDir||The root directory of the recording files. The sub-path is generated automatically according to the recording date to save the recording file.|
|lowUdpPort||The lowest UDP port. Ensure that the value is a positive integer and the value of
|highUdpPort||The highest UDP port. Ensure that the value is a positive integer and the value of
|getAudioFrame||Audio decoding format.
|getVideoFrame||Video decoding format.
|captureInterval||Time interval of the screen capture. The value ranges between one second and five seconds.
|cfgFilePath||The path of the configuration file. The default value is NULL. In the configuration file, you can set the absolute path of the recorded file, but the subpath is not generated automatically. The content in the configuration file must be in JSON format, such as
|streamType||Sets the type of video stream.
|triggerMode||Sets whether to start recording automatically or manually.
|proxyServer||Sets the IP address and port number of the proxy server. For example, "127.0.0.1:1080".|
|audioProfile||Audio profile of the recording file. Sets the sample rate, bitrate, encode mode, and the number of channels.
The high-fidelity audio takes effect only when
The stereo audio profile does not support the raw audio data.
|audioIndicationInterval||Whether or not to detect speakers. Disabled by default.
|defaultVideoBg||The default background image of the canvas.|
|defaultUserBg||The default background image of the user.|
|logLevel||Sets the log level. Only log levels preceding the selected level are generated. The default value of the log level is 5.
|layoutMode||Sets the video mixing layout.
After the recording is complete, use the transcoding script to merge the recorded files. See Using the Transcoding Script.