On-Premises Recording
  • Linux : C++
  • Overview
  • SDK Downloads
  • Sample Codes
  • Quick Starts
  • Performance Data
  • API Documents
Sample Code
Download

Demo Instructions

1 Run the Demo

Assume that the On-Premises Recording Demo is placed in the /root directory.

The content of the directory where the On-Premises Recording Demo is as follows:

step1:

cd ~/ZegoServerRecordingDemo

step2:

chmod 777 playrecorder

step3:

export LD_LIBRARY_PATH=./libs/:$LD_LIBRARY_PATH

step4:

./playrecorder -r roomID

The roomID here is the roomID to which the stream to be recorded belongs. If no additional parameters are set, the default is to record 20 seconds, record a single stream, and generate an mp4 file with audio and video.

Note: If there is no stream in the filled roomID, the recording will not proceed.

  • Optional command-line additional parameters are as follows:

    -r -- RoomID to which the recording stream belongs

    -d -- Recording time, in minutes

    -m -- Recording mode, 1 means only record single stream, 2 means only record mixed stream, 3 means record both single stream and mixed stream

    -s -- Single stream recording type, 1 means only record audio, 2 means only record video, 3 means record audio and video

    -x -- Mixed stream recording type, 1 means only record audio, 2 means only record video, 3 means record audio and video

    -o -- Recording output mode, 1 means only record files are generated, 2 means only audio and video data are returned

    -t -- The output recording file type, single stream recording can only be mp4, mixed stream recording can be mp3 or mp4

    -g -- Generate mp3 files while generating mp4 files

    -b -- Cache size, the value range is [64k~1M], default is 1M

    -h -- help, no parameter values

2 Rebuild Demo

Note:If you need to rebuild the Demo, you need to fill in the AppID and AppSign that have been applied in the place where InitSDK is called.

Modify the LiveRoomRecorder::Start(struct config *cfg) method in the LiveRoomRecorder.cpp file, see the figure below for the modification location:

unsigned int appId = appID; // Here is the AppID, which needs to be converted from a string to an unsigned integer
unsigned char signature[] = appSign; // Fill in the AppSign corresponding to the AppID here. You need to convert the AppSign from a string to a byte array
LIVEROOM::InitSDK(appId, signature, 32);

For how to apply for AppID, please refer to User Manual . For the conversion method of AppID and AppSign, please refer to the GetAppSign method.

After filling in the correct AppID and AppSign, you can rebuild and run the Demo.