This page shows how to set up the environment to integrate the Agora On-premise Recording SDK.
The Agora On-premise Recording SDK for Linux is integrated on your Linux server instead of in your app.
Recording audio and video within a channel is like a special audience joining the channel. The audience gets the audio and video from the channel, transcodes it, and stores it on a Linux server. Therefore, you must integrate the On-premise Recording SDK on your Linux server. The same App ID is used in the On-premise Recording SDK and the Agora SDK for audio and video calls.
The following table lists the basic requirements for installing the On-premise Recording SDK:
Hardware or Network | Requirements |
---|---|
Server | Physical or virtual. |
System | Ubuntu 14.04+ x64 or CentOS 6.5+ (7.0 recommended) x64. |
Network | The Linux server needs Internet access. |
Internet Bandwidth | Use an Internet bandwidth based on the number of channels being recorded simultaneously. Refer to the following data:
For detailed bandwidth data, see Recording API. |
We conduct tests on the recording concurrency based on the following cloud hosting configuration:
Test conditions:
Test results:
Channel Profile | Recording Mode | Performance |
---|---|---|
Live Broadcast | Audio + Video Individual recording |
When recording 215 channels simultaneously, the CPU usage is about 75%. We recommend recording 200 channels simultaneously. |
Audio + Video Composite recording |
When recording 70 channels simultaneously, the CPU usage is about 75%. We recommend recording 60 channels simultaneously. |
|
Audio only Composite recording |
When recording 300 channels simultaneously, the CPU usage is about 75%. | |
Communication | Audio + Video Individual recording |
When recording 210 channels simultaneously, the CPU usage is about 75%. We recommend recording 200 channels simultaneously. |
Audio + Video Composite recording |
When recording 60 channels simultaneously, the CPU usage is about 75%. |
The test results are for reference purposes only. Set up your own cloud hosting according to your recording requirement.
Set up the environment on your Linux server:
Download the Agora On-premise Recording SDK for Linux package. The package structure is listed as follows:
Folder | Description |
---|---|
bin | The directory where AgoraCoreService is located. |
include |
|
libs | Required libraries for developing the recording application. |
samples | Sample code
|
Tools | Transcoding tools. |
Ensure that your compiler is GCC 4.4+.
Set up the Java Development Kit and ensure jni.h is included.
Set CLASSPATH
in Java and LD_LIBRARY_PATH
in Linux.
If your firewall restricts access to the Agora services, use cloud proxy service.
Open the UDP ports used by the recording processes. The UDP ports are the ports between the lowUdpPort
and highUdpPort
parameters specified in RecordingConfig
.
- Use the
iptables -L
command line to check the UDP port.- To record the content in the channels, you need one recording process for each of the channels. One recording process requires four UDP ports. There must be no port conflict among the processes, including the system processes and all recording processes.
- We recommend that you specify the range of ports used by the recording processes. Configure a large range for all recording processes (Agora recommends 40000 to 41000 or larger). If so, the On-premise Recording SDK assigns ports to each recording process within the specified range and avoids port conflicts automatically. To set the port range, you need to configure the
lowUdpPort
andhighUdpPort
parameters.- If the
lowUdpPort
andhighUdpPort
parameters are not specified, the ports used by the recording processes are at random, which may cause port conflicts.
Run the following command to pre-set the environment under the samples/java directory. Replace jni_path with the absolute path of the jni.h file. For example, /usr/java8u161/jdk1.8.0_161/include/:
source build.sh pre_set jni_path
Execute the build script under the samples/java directory:
./build.sh build
After the compilation, a librecording.so file is generated in the samples/java/bin/io/agora/recording directory, as shown in the following figure.
Now you can use the demo to start recording by command line, see Record a Call. If you want to call APIs, you need to import the SDK files to your project.
Import the following files to your project:
librecording.so
AgoraCoreService
in the bin folderRecordingEventHandler.java
RecordingSDK.java
/common/Common.java
/common/RecordingConfig.java
/common/RecordingEngineProperties.java
For example, if the project root directory is ROOT_DIR
, you need to copy the librecording.so
file to ROOT_DIR/lib
, copy the AgoraCoreService
file to ROOT_DIR/bin
, and copy the Java files to ROOT_DIR/src/io/agora/recording
.
When running the Java project, set -Djava.library.path=ROOT_DIR/lib
to specify the path to the dynamic library. Note that you need to set the appliteDir
parameter as ROOT_DIR/bin
in RecordingConfig
when starting a recording.
The Agora On-premise Recording SDK is integrated. You can start recording by calling APIs, see Agora Recording Java API Reference.