Step 1: Prepare the Environment¶
Be sure that you have compiled the sample code for communication or live broadcast on the specific platform.
Download the latest Agora Recording SDK for Linux package. The package structure is listed as follows:
- bin: applite application video_recorder
- include :the required header files for developing the recording applicaiton
- libs : the required libraries for developing the recording application
- samples : one sample code main.cpp (required in this document) and one recording application to launch recording with command line.
- tools : the transcoding tools ffmeg.zip and video_convert.py
Be sure that the following Operating System requirements are satisfied:
- Ubuntu 12.04 x64 or later
- CentOS 6.5 x64 or later
Be sure that the following compiler requirement is satisfied: gcc 4.4 or later
Prepare an App ID. For details, see Obtaining an App ID.
Step 2: Compile the Sample Code¶
Run the following command under the samples directory to compile the sample code:
After the compilation, a Record_local executable application is generated in the directory.
Step 3: Demonstrate the Recording¶
Run ./Record_local to check the related usage, for example,
./RECORD_APP --appId STRING --uid UINTEGER32 --channel STRING --appliteDir STRING --channelKey STRING --channelProfile UINTEGER32 --isAudioOnly 0/1 --isMixingEnabled 0/1 --decryptionMode STRING --secret STRING --idle INTEGER32 --recordFileRootDir STRING --lowUdpPort INTEGER32 --highUdpPort INTEGER32 --appId (App Id/must) --uid (User Id default is 0/must) --channel (Channel Id/must) --appliteDir (directory of app lite 'video_recorder', Must pointer to 'Agora_Recording_SDK_for_Linux_FULL/bin/' folder/must) --channelKey (channelKey/option) --channelProfile (channel_profile:(0:COMMUNICATION),(1:broadcast) default is 0/option) --isAudioOnly (Default 0:ARS (0:1)/option) --isMixingEnabled (Mixing Enable? (0:1)/option) --decryptionMode (decryption Mode, default is NULL/option) --secret (input secret when enable decryptionMode/option) --idle (Default 300s/option) --recordFileRootDir (recording file root dir/option) --lowUdpPort (default is random value/option) --highUdpPort (default is random value/option)
Both methods implement the same functions, select one of them according to your actual needs. The Recording SDK joins the channel like a dumb client, and it must joins the same channel as the Agora Native SDK with the same App ID, but you have two ways to set the parameter uid:
- Set it as 0, then the system will assign a UID randomly
- Set it as a unique User ID different from any of the existing UIDs in the same channel
|appId||Yes||App ID. See Obtaining an App ID|
The user ID: a 32-bit unsigned integer ranges from 1 to (2^32-1). It must be unique.
|channel||Yes||A string providing the unique channel name|
|appliteDir||Yes||The directory that stores the Linux SDK built-in applite application video_recorder . The directory in SDK is Agora_Recording_SDK_for_Linux_FULL/bin/|
|channelKey||Optional||For users who have high security requirements, get a Channel Key according to Obtaining and Using a Dynamic Key|
|channelProfile||Optional||The channel mode: communication(default) or live broadcast|
|isAudioOnly||Optional||Whether only to record the audio content. The parameter is disabled by default.|
Whether to record audio mixing or/and video mixing. The parameter is disabled by default.
|decryptionMode||Optional||Whether to enable the built-in decryption function. The parameter is disabled by default.|
|secret||Optional||The decryption password after you enabled the decryption mode.|
|idle||Optional||The channel idle duration. After this duration, the channel is automatically disconnected. If no user in the channel succeeds the predifined duration, the recording stops automatically. The default value is 300 seconds.|
|recordFileRootDir||Optional||The root directory that stores the recording file.|
|lowUdpPort ||Optional||The lowest UDP port|
|highUdpPort ||Optional||The highest UDP port|
|||(1, 2) All the ports being set must be positive integers, and the value of highUdpPort - lowUdpPort must be no less than 4.|