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.

Prerequisites

Hardware and network requirements

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:

  • When the resolution of the recorded scene is 640 x 360, the bandwidth is 500 Kbps.
  • To record a channel with two users, you need a bandwidth of 1 Mbps.
  • To record 100 channels, you need a bandwidth of 100 Mbps.

For detailed bandwidth data, see Recording API.

We recommend the following hardware requirements:

Product Description Number
SUPERMICRO SYS-6017R-TDF 1U rack-mounted SYS-6017R-TDF Intel® Xeon® E5-2600 Series Processor 1
Case 1U Rackmountable (440-W high-efficiency redundant power supply w/ PMBus) 1
Processor Intel Xeon E5-2620V2 2.1 G, L3:15M, 6C (P4X-DPE52620V2-SR1AN) 2
Memory MEM-DR380L-HL06-ER16 (8-GB DDR3-1600 2Rx8 1.35-V ECC REG RoHS) 1
Hard Disk 250-G 3.5 SATA Enterprise (HDD-T0250-WD2503ABYZ) 2

Assuming two users are in a channel in a video call (Communication profile), with a resolution of 640 x 360, a frame rate of 15 fps, and a bitrate of one video stream of 500 Kbps, using single-stream recording:

The CPU with 12 cores and 24 threads is fully loaded and 100 channels are recorded simultaneously:

  • Each channel writes to the disk at a speed of 60 Kbps. The total write-in speed is 6.0 Mbps, which is much lower than the maximum write-in speed of the disk.
  • Each channel uses 25 MB of memory. Thus, 2.5 GB of memory, which is 31% of the total memory, is used.
  • The downlink Internet bandwidth for each channel is 500 Kbps x 2 = 1 Mbps. The total downlink bandwidth is 100 Mbps. The uplink bandwidth is neglected.

Compatibility with Agora SDKs

The recording SDK supports:

  • Recording communication that uses the Native SDK.
  • Recording communication that uses the Web SDK.
  • Recording communication that uses both the Native SDK and the Web SDK.

The On-premise Recording SDK is compatible with the following Agora SDK versions:

Agora SDK Compatible versions
Agora Native SDK v1.7.0+
Agora Web SDK v1.12.0+

If any user in the channel uses an Agora SDK which is not compatible with the Agora On-premise Recording SDK, recording fails for the whole channel.

Set up the environment

Set up the environment on your Linux server:

  1. 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
    • base: Required header files for developing the recording application.
    • IAgoraLinuxSdkCommon.h: Public structure and enumeration.
    • IAgoraRecordingEngine.h: Interface of the recording engine and its configuration.
    libs Required libraries for developing the recording application.
    samples

    Sample code

    • agorasdk: Demo that implements the C++ interface and callbacks.
    • base: Public sample code.
    • cpp: C++ sample code.
      • release/bin/recorder: Parent process that can be run.
    • java: Java sample code.
      • native: Native code.
      • native/jni: JNI delegate.
      • src: Java code.
      • src/io/agora/recording/RecordingEventHandler.java: Callback interface class.
      • src/io/agora/recording/RecordingSDK.java: Recording interface class.
    Tools Transcoding tools.
  2. Ensure that your compiler is GCC 4.4+.

  3. Set up the Java Development Kit and ensure jni.h is included.

  4. Set CLASSPATH in Java and LD_LIBRARY_PATH in Linux.

  5. Open the following TCP ports: 1080 and 8000.

  6. Open the following UDP ports:

    • Duplex ports: 1080, 4000 to 4030, 8000, 9700, and 25000.
    • Simplex downlink ports used by the recording processes.
    • 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 simplex downlink 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 and highUdpPort parameters.
    • If the lowUdpPort and highUdpPort parameters are not specified, the ports used by the recording processes are at random, which may cause port conflicts.
  7. Whitelist the following domains:

    • .agora.io
    • .agoralab.co
  8. For debugging purposes, we recommend that you enable core dump on your Linux system.

Compile the sample code

  1. 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
  2. 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 files

Import the following files to your project:

  • librecording.so
  • AgoraCoreService in the bin folder
  • All the Java files under samples/java/src/io/agora/recording
    • RecordingEventHandler.java
    • RecordingSDK.java
    • /common/Common.java
    • /common/RecordingConfig.java
    • /common/RecordingEngineProperties.java

The Agora On-premise Recording SDK is integrated. You can start recording by calling APIs, see Agora Recording Java API Reference.