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:
crash_restore.sh
script. 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 uid_UID_timestamp.txt
files.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) | -- isVideoOnly 1 -- isMixingEnabled 1 |
One video file in TS format | One video file in MP4 format |
Composite recording | Audio and video | --isMixingEnabled 1 --mixedVideoAudio 2 |
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 | uid_UID_timestamp.txt files.uid_UID_timestamp.txt files. If you want to use the transcoding script to merge the separated audio file and video file into one MP4 file, you must first run the crash_restore.sh script to repair the uid_UID_timestamp.txt files. |
|
4 | uid_UID_timestamp.txt files incomplete.crash_restore.sh script to convert these TS files into MP4 files and restores the uid_UID_timestamp.txt files. |
crash_restore.sh script to convert these TS files into MP4 files. |
crash_restore.sh
scriptLinux operating system
Python 3.0 or later
FFmpeg 4.0 or later (The Agora Recording SDK provides FFmpeg in the tools folder.)
File preparation
Ensure that the recording files are stored in an accessible directory.
Run the following command:
$ ./crash_restore.sh <recorderDir>/
Where 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 uid_UID_timestamp.txt
files.
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: