Skip to main content
DouyinLiveRecorder can execute a custom script after each recording session finishes. Use this to upload files to cloud storage, trigger notifications, move files, or run any post-processing step.

Configuration

Enable the feature and specify the script command in config/config.ini:
是否录制完成后执行自定义脚本 = 是
自定义脚本执行命令 = python /path/to/your/script.py
Set 是否录制完成后执行自定义脚本 to to disable without removing the command.

Supported script types

  • Python scripts — invoked when the command contains python
  • Windows batch files (.bat) — invoked directly by the shell on Windows
  • Linux bash scripts — invoked directly by the shell on Linux

Parameters passed to scripts

The recorder appends parameters to your command automatically after recording finishes.

Python scripts

Named arguments are appended:
python script.py \
  --record_name "序号1 AnchorName" \
  --save_file_path "/path/to/file.ts" \
  --save_type TS \
  --split_video_by_time True \
  --converts_to_mp4 False
ParameterTypeDescription
--record_namestringSequence number and anchor display name, e.g. 序号1 AnchorName
--save_file_pathstringAbsolute path to the recorded file (last segment if segmented)
--save_typestringFormat used: TS, FLV, MKV, MP4, MP3音频, or M4A音频
--split_video_by_timeboolWhether segment recording was active (True/False)
--converts_to_mp4boolWhether auto-convert to MP4 was active (True/False)

Batch and bash scripts

Positional arguments are appended in this order:
script.bat "AnchorName" "/path/to/file.ts" TS split_video_by_time:False converts_to_mp4:True
PositionValue
1Anchor name (without sequence prefix)
2Absolute path to the recorded file
3Save format (TS, FLV, etc.)
4split_video_by_time:True or split_video_by_time:False
5converts_to_mp4:True or converts_to_mp4:False

Example scripts

import argparse
import shutil

parser = argparse.ArgumentParser()
parser.add_argument('--record_name')
parser.add_argument('--save_file_path')
parser.add_argument('--save_type')
parser.add_argument('--split_video_by_time')
parser.add_argument('--converts_to_mp4')
args = parser.parse_args()

print(f"Recording finished: {args.record_name}")
print(f"File: {args.save_file_path}")
print(f"Format: {args.save_type}")

# Example: move file to a different directory
shutil.move(args.save_file_path, f"/archive/{args.save_file_path.split('/')[-1]}")
On Linux, bash scripts must have #!/bin/bash as the first line and the executable bit set:
chmod +x /path/to/your/script.sh
If either requirement is missing, the script will fail with a permission error.
Common use cases for post-recording scripts:
  • Upload completed recordings to cloud storage (rclone, AWS S3, Backblaze B2)
  • Send a custom notification to a webhook or messaging app
  • Move files into a structured archive directory by date or anchor name
  • Trigger a video processing pipeline (thumbnails, transcoding, metadata extraction)

Build docs developers (and LLMs) love