DouyinLiveRecorder uses FFmpeg to write the incoming stream to disk. You can choose from six output formats in config/config.ini:
视频保存格式ts|mkv|flv|mp4|mp3音频|m4a音频 = ts
FLV format does not support the H.265 (HEVC) codec. On platforms that stream H.265 (such as Douyin and TikTok), DouyinLiveRecorder automatically falls back to TS format when an H.265 FLV stream is detected.
| Format | Type | Notes |
|---|
ts | Video | MPEG-TS container. Recommended for live recording — resilient against unexpected interruptions |
mkv | Video | Matroska container. Flexible codec support, good for archiving |
flv | Video | Flash Video. No H.265 support. Some platforms (Shopee, 花椒直播) always record in FLV regardless of this setting |
mp4 | Video | MP4 container. Requires a complete, seekable stream — more fragile for live recording |
mp3音频 | Audio | MP3 audio only, 320 kbps. Suitable for audio-only platforms (猫耳FM, Look直播) |
m4a音频 | Audio | AAC audio in M4A container, 320 kbps. Smaller than MP3 at equivalent quality |
The recommended workflow for most use cases is to record in TS format and enable auto-conversion to MP4. TS is safe against stream interruptions — a crashed recording leaves a fully readable file. The MP4 conversion runs as a background thread after each recording session finishes.
Auto-convert TS to MP4
When enabled, each completed TS file is automatically remuxed to MP4 using FFmpeg. No re-encoding is done by default — the conversion is nearly instant.
The FFmpeg command used for a stream-copy conversion:
ffmpeg -i input.ts -c:v copy -c:a copy -f mp4 output.mp4
Re-encode to H.264
If the source uses a codec that causes compatibility issues (for example H.265 on older players), enable H.264 re-encoding:
The FFmpeg command used when re-encoding is enabled:
ffmpeg -i input.ts \
-c:v libx264 -preset veryfast -crf 23 \
-vf format=yuv420p \
-c:a copy \
-f mp4 output.mp4
Re-encoding increases CPU usage and processing time significantly. Only enable this when compatibility with a specific player or device requires it.
Delete original after conversion
To remove the source TS (or FLV/MKV) file after conversion completes:
The original file is deleted only after FFmpeg exits with a success code.
Audio-only recording
For the mp3音频 format, the FFmpeg command used during recording:
ffmpeg -i <stream_url> -map 0:a -c:a libmp3lame -ab 320k output.mp3
For the m4a音频 format, post-conversion uses:
ffmpeg -i input -n -vn -c:a aac -bsf:a aac_adtstoasc -ab 320k output.m4a
When recording m4a音频 directly (without post-conversion), the inline recording path adds -movflags +faststart for seekability.
Platforms 猫耳FM and Look直播 are audio-only and are always recorded in an audio format regardless of the global format setting.