Before v3.0.3, the MP4 files generated after a recording might not be playable due to recording crashes. To solve this issue, as of v3.0.3, the Agora Recording SDK provides the following solutions:
- The SDK now generates video files in TS format during the recording. When the recording ends, the SDK automatically converts these TS files into MP4 format. Even if occasional crashes occur during the recording, the MP4 files can still be played.
- The SDK adds the
crash_restore.shscript. If the recording service quits after multiple crashes, you can run the script to convert these TS files into MP4 files and repair the incomplete
The Agora Recording SDK generates recording files in TS format during the recording process in the following scenarios:
|Recording mode||Recording Type||Parameter Settings||Recording files and formats during the recording||Recording files and formats after the recording|
|Individual recording||Audio and video||Default settings|
|Composite recording||Video (no audio)||
|One video file in TS format||One video file in MP4 format|
|Composite recording||Audio and video||--
||One file in TS format containing both audio and video||One file in MP4 format containing both audio and video|
In different recording modes, you need to convert and repair the recording files based on the number of crashes in a single recording process, as shown in the following table:
|Number of crashes||Individual recording||Composite recording|
|Fewer than 4||
Linux operating system
Python 3.0 or later
FFmpeg 4.0 or later (The Agora Recording SDK provides FFmpeg in the tools folder.）
Ensure that the recording files are stored in an accessible directory.
Run the script
Run the following command:
$ ./crash_restore.sh <recorderDir>/
recorderDir is the directory of your recording files.
When you run the command, the script searches for all files in TS format in the directory and converts them to MP4 format one by one. In individual recording mode, the script also searches for and repairs the
The name of the converted MP4 files are the same as the source TS files. The source TS files are not deleted after this conversion process, in case they are needed later.
To convert all the TS files under the
20200915 folder to MP4 format and repair the
uid_UID_timestamp.txt files, use the following command:
$ ./crash_restore.sh 20200915/
Before the conversion and repair:
After the conversion and repair:
- As of v3.0.3, after a recording ends, you need to wait for the conversion to complete before you can get the MP4 files. The time required for this conversion depends on the IOPS of the server and the total size of the TS files to be converted. For example, it takes approximately 85 to 150 seconds to convert a 4GB TS file (this data is for reference only).
- The conversion process consumes disk I/O resources. If the server disk performance is poor, Agora recommends you do not perform other operations until the conversion is completed.