This page shows how to set up the environment to integrate the Agora Recording SDK.

The Agora 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 Recording SDK on your Linux server. The same App ID is used in the 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 Recording SDK:

Hardware and Network Requirements
Server Physical or virtual.
System Ubuntu Linux 14.04+ LTS 64-bit or CentOS 7+ 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.

Agora recommends 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 mode), with a resolution of 640 x 360, frame rate of 15 fps, and bitrate of one video stream of 500 Kbps, using single-stream recording:

The CPU is fully loaded and 100 channels are recorded simultaneously:

  • Each channel writes to the disk at a speed of 60 kB/s. The total write-in speed is 6.0 MB/s, 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 stream is 100 Mbps. The uplink stream is neglected.

Compatibility with the 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 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 Recording SDK, recording fails for the whole channel.

Set up the Environment

  1. Download the Agora 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
  1. Open the following TCP ports: 1080 and 8000.

  2. 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 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.
    • Agora recommends 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 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.
  1. Set whitelist domains:

    • agora.io
    • vocs.agora.io
    • qoslbs.agora.io
    • qos.agora.io
  2. Ensure that your compiler is gcc 4.4+.

  3. Prepare the required library:

    • Add the include folder to your project.
    • Add the lib folder to your project and make sure the libRecordingEngine.a file is connected to the project.
  4. For debug purposes, Agora recommends you enable core dump on your Linux system.

Compile the Sample Code

Open a command-line tool and run the following command to compile the sample code under the samples/cpp directory.

make

After the compilation, a record_local executable file is generated in this directory, as shown in the figure.

The Agora Recording SDK is integrated.

Next Steps

Learn how to record by using the command line: Record a Call.