add translate for config (#4678)
Some checks failed
Android / build (push) Has been cancelled
CodeQL / Analyze (cpp) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
Docker / build (push) Has been cancelled
Linux / build (push) Has been cancelled
Linux_Python / build (push) Has been cancelled
macOS / build (push) Has been cancelled
macOS_Python / build (push) Has been cancelled
Windows / build (push) Has been cancelled
Windows_Python / build (push) Has been cancelled

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
YuLi 2026-03-15 00:10:51 -07:00 committed by GitHub
parent f78c5545a6
commit a13063c5e4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 697 additions and 242 deletions

View File

@ -0,0 +1,137 @@
---
name: Project General Translation & Terminology Guidelines
description: Definitive guidelines, contextual awareness strategies, standard terminology, and comment formatting rules for translating code, configurations, and documentation from Chinese to English in this repository.
---
# 🤖 Systemic Translation & Terminology Instructions for AI Agents
This document is the absolute source of truth and **Standard Operating Procedure (SOP)** for translating Chinese comments, configurations, and documentation into English within this repository.
**ATTENTION AI AGENTS:** You are NOT merely translating words; you are executing a systematic algorithm to localize complex streaming media and networking concepts. Do not rely solely on "passive reading" or "translation memory." You MUST follow the rigid workflow outlined below.
---
## Phase 1: Contextual Anchoring (MANDATORY BEFORE TRANSLATION)
Before translating any block of text, you must explicitly anchor yourself to the specific technical domain. **Literal translation of Chinese industry slang (黑话) is strictly prohibited.**
1. **Identify the Domain:** Look at the module or configuration section (e.g., `[rtp_proxy]`, `[http]`, `[general]`, `[hls]`).
2. **Setup the Mental Lexicon:**
- If `[api]/[http]`: Anchor to standard REST API and Web server concepts (e.g., `Requests/Responses`, `CORS`, `Forwarded IPs`).
- If `Network I/O / [general]`: Anchor to socket programming and OS-level terms (e.g., `Write coalescing`, `Buffers`, `File handles`).
- If `Media Streaming (RTSP/RTMP/RTC)`: Anchor to multimedia transport concepts (e.g., `GOP`, `Payload`, `B-frames`, `Jitter`, `Visual artifacts`).
3. **Verification-Driven Translation:** If you encounter a Chinese term that sounds colloquial or metaphoric (e.g., “花屏” - flowered screen, “秒开” - open in seconds, “溯源” - trace back to origin), **DO NOT guess or translate literally**. Ask yourself: _"How do top-tier English open-source projects (FFmpeg, WebRTC, Nginx) refer to this specific technical phenomenon?"_
---
## Phase 2: Structural Translation & Anti-Pattern Detection
LLMs naturally tend to follow the grammatical structure of the source text. Chinese technical writing often uses sprawling sentences and explanatory fillers. You must actively break these patterns.
### 🚫 Rule 1: The "Action-Result" Paradigm
- **Trigger:** When the Chinese text says "设置为0关闭此特性" (Setting this to 0 disables this feature) or "打开此选项会导致..." (Turning this on causes...).
- **Execution:** Force your output to use the exact structure: `Setting this to [Value] disables [Feature] and allows [Consequence].` Do NOT translate explanatory filler like "This mechanism's logic dictates that...".
### 🚫 Rule 2: Sub-clause Elimination (No "Chinglish")
- **Trigger:** Long noun clusters or overly personified system descriptions (e.g., "服务器会认为这个流是断开的" - The server will think this stream is disconnected).
- **Execution:** Use direct, objective voice: `The stream is considered disconnected.` or `The system drops the stream.`
### 🚫 Rule 3: Clarifying Ambiguous Actions
- **Trigger:** The word `忽略` (Ignore/Skip) vs. `丢弃/放弃` (Abandon/Drop).
- **Execution:** Use `Ignore` or `Skip` for non-critical timeouts (e.g., waiting for a track to be ready). Reserve `Abandon`, `Drop` or `Disconnect` only for fatal errors or closed sockets.
### 🚫 Rule 4: Zero Information Loss & Causal Reconstruction
- **Trigger:** When condensing text for native flow, or translating complex caveats (e.g., parenthetical conditions, "而不是" / instead of, side-effects).
- **Execution:** You may reorganise syntax to sound professional, but you MUST NOT drop crucial qualifiers, modifiers, or side effects. If a Chinese config says "instead of returning X via hook", the English translation must explicitly mention "returning X". Information completeness supersedes structural brevity.
### 🚫 Rule 5: The Golden Balance (Zero Info Loss vs. Native Phrasing)
- **The Core Conflict:** You must achieve **Zero Information Loss** WITHOUT resorting to **Chinglish** or literal word-for-word translation.
- **What "Information" Means:** "Retaining information" means capturing 100% of the **technical causality**, **side-effects**, **prerequisites**, and **system boundaries** present in the Chinese text.
- **What "Information" DOES NOT Mean:** It does NOT mean preserving the Chinese grammatical structure, literal phrasing, or colloquialisms (啰嗦句子和字面用词).
- **Execution (The Top-Down Conceptual Approach):**
1. **Contextual Override:** Never translate a noun literally if the surrounding constraints (e.g., units like "seconds", prefixes, or the specific protocol) dictate a domain term. For example, if a setting is measured in "seconds", the Chinese word "大小" (size) MUST logically translate to `Duration` or `Interval`, **NEVER** `Size`.
2. **Conceptual Compression:** When faced with a sprawling, explanatory Chinese sentence, distill the _technical payload_ and express it using concise, standard industry jargon.
- _Anti-pattern (Literal/Chinglish):_ `After disabling the traditional authentication mode, you must first call the API to log in. Upon success, a cookie will be set, and all APIs can be accessed without restriction as long as the cookie is valid.`
- _Pro-pattern (Native/Jargon):_ `When disabled, users must first call /index/api/login. Upon success, a cookie auth token is set for subsequent requests.` (Using "subsequent requests" efficiently compresses the lengthy Chinese explanation).
3. **Technical Abstraction:** Recognize standard operations (e.g., "拉流再推流"). Do not translate the physical actions (`pulling and then pushing`); translate the abstract technical process (`re-publishing` or `re-encoding`).
### 🚫 Rule 6: Anti-Summarization (Strict Boolean & Causality Preservation)
- **Trigger:** When applying Conceptual Compression (Rule 5) to a text block containing conditionals or explanations.
- **The Core Conflict:** _Compression_ reduces word count by using jargon. _Summarization_ drops critical logic. **Summarization is strictly forbidden.**
- **Execution (The Boolean Mapping Rule):**
1. Treat Chinese comments like code blocks. Extract all `IF/THEN/ELSE` branches, prerequisites, and root causes before translating.
2. If the original text states a "success" path and a "failure" path, the English translation MUST explicitly state both paths. You cannot compress them into a single vague outcome.
3. If the original text states _why_ a feature exists (the exact cause or defect being prevented), the English translation MUST explicitly state that exact cause. You cannot compress it into generic "to improve performance" or "to prevent errors."
4. Perform a **Reverse Mapping Check**: After writing the English sentence, ask yourself—"If I reverse-compile this English back to Chinese, would any `IF` conditions or edge-case explanations be missing?" If yes, rewrite it completely to restore the dropped logic.
---
## Phase 3: The Hardcoded Terminology Dictionary
**CRITICAL:** When translating, if you encounter these Chinese concepts, you MUST use the exact, first provided English term. **Do not mix or alternate synonyms.**
### Network & Architecture
- 源站 -> `Origin server`
- 溯源 (拉流) -> `Origin pull`
- 推流代理 / 拉流代理 -> `Publishing proxies` / `Pulling proxies`
- 按需拉流 -> `On-demand stream pulling`
- 集群 -> `Cluster`
- 推流断开后的超时等待 -> `Grace period for publisher reconnection`
### Video & Playback Experience
- 秒开 / 极速秒开 -> `Instant playback (zero-delay startup)` (e.g., 级联秒开 -> `Instant playback for cascaded streams`)
- 花屏 -> `Visual artifacts (glitches)` _(NEVER use "Screen tearing", which is a hardware V-sync issue)_
- 卡顿 -> `Playback stuttering`
### System I/O & HTTP
- 合并写 -> `Write coalescing` _(NEVER use "Merged write")_
- 请求和回复 -> `Requests and Responses` _(Avoid "Replies")_
- 在代理后方获取真实IP -> `Extract the real client IP when behind a proxy (e.g., via X-Forwarded-For)`
### General Technical Terms
- 切片 -> `Segment` (e.g., HLS segment)
- 封装 / 打包 -> `Packaging`
- 负载 -> `Payload`
- 鉴权 -> `Authentication`
- 处理 / 应对 (故障) -> `Handle` or `Address`
---
## Phase 4: Strict Formatting Rules (CRITICAL)
When translating comments inside code files (`.cpp`, `.h`) or configs (`.ini`), apply these hard constraints:
1. **Bilingual Retention:** Unless explicitly instructed to delete Chinese, **ALWAYS retain the original Chinese comments**.
2. **Bottom Placement:** Place the English translation immediately **below** the Chinese line or block.
3. **Block Uniformity:** Do NOT translate line-by-line (`ZH-EN-ZH-EN`). If a Chinese comment is a 3-line block, output it as a 3-line Chinese block followed by a 3-line English block.
```cpp
/*
* 这里是第一行中文描述。
* 这里是第二行中文补充。
*/
/*
* This is the English translation of the first line.
* This is the English translation of the second line.
*/
```
---
## Phase 5: The Post-Translation Verification Workflow (DO NOT SKIP)
If you are asked to review or update translations in a long file, **you cannot rely solely on passive reading**. You MUST execute this workflow:
1. **Active Scan (Regex/Search):** Before reading the document, use file search tools to actively scan for known anti-patterns in the current English text (e.g., search for `Screen tearing`, `Merged write`, `Replies`, `Source station`). Fix them immediately.
2. **Format Review:** Scan for `ZH-EN-ZH-EN` interleaving and fix it to block format.
3. **Blind English Review:** After translating, hide the Chinese text from your mental context. Read _only_ your English output constraint: _Does this sound like a snippet from the official Nginx or WebRTC manuals? Is it concise (CBD: Clarity, Brevity, Directness)?_ If it sounds like a literal word-for-word translation, rewrite it natively.

1
.claude/skills Symbolic link
View File

@ -0,0 +1 @@
../.agent/skills

View File

@ -4,210 +4,365 @@
#!!!!你如果修改此范例配置文件(conf/config.ini)并不会被MediaServer进程加载因为MediaServer进程默认加载的是release/${操作系统类型}/${编译类型}/config.ini。
#!!!!当然你每次执行cmake该文件确实会被拷贝至release/${操作系统类型}/${编译类型}/config.ini
#!!!!但是一般建议你直接修改release/${操作系统类型}/${编译类型}/config.ini文件修改此文件一般不起作用,除非你运行MediaServer时使用-c参数指定到此文件。
#!!!! This is a sample configuration file intended to explain the specific meanings and functions of each item.
#!!!! During the `cmake` execution, this file is copied to the `release/${OS type}/${build type}` directory.
#!!!! This directory is also the target path where the MediaServer executable runs and looks for `config.ini` by default.
#!!!! Modifying this sample file (`conf/config.ini`) will not affect the MediaServer process while it runs.
#!!!! Although executing `cmake` overwrites the target config file, it is highly recommended to modify `release/${OS type}/${build type}/config.ini` directly.
#!!!! Changes made here will only take effect if you explicitly load this file using the `-c` parameter when starting the MediaServer.
[api]
# 是否调试http api,启用调试后会打印每次http请求的内容和回复
# Enable HTTP API debugging. When enabled, it logs the content and responses of each HTTP request.
apiDebug=1
# 一些比较敏感的http api在访问时需要提供secret否则无权限调用
# 如果是通过127.0.0.1访问,那么可以不提供secret
# For some sensitive HTTP APIs, a secret must be provided when accessing them, otherwise the call is unauthorized.
# If accessed via 127.0.0.1, the secret does not need to be provided.
secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc
# 截图保存路径根目录截图通过http api(/index/api/getSnap)生成和获取
# Root directory for saving snapshots generated via the `/index/api/getSnap` API.
snapRoot=./www/snap/
# 默认截图图片在启动FFmpeg截图后但是截图还未生成时可以返回默认的预设图片
# Default placeholder image returned while FFmpeg is generating the actual snapshot.
defaultSnap=./www/logo.png
# downloadFile http接口可访问文件的根目录支持多个目录不同目录通过分号(;)分隔
# Root directories accessible via the `downloadFile` API. Separate multiple directories with semicolons (;).
downloadRoot=./www
# 是否采用传统secret硬编码鉴权模式默认开启开启后每次http接口请求都需要传递secret
# 关闭传统鉴权模式后,需要先调用/index/api/login接口登录成功后将设置cookie在cookie有效期内访问所有接口都将放行。
# Whether to enable the legacy secret-based authentication mode (enabled by default). When enabled, every API request requires the secret.
# When disabled, users must first call `/index/api/login`. Upon success, a cookie auth token is set, allowing unrestricted access to all APIs while the cookie remains valid.
legacyAuth=1
[ffmpeg]
# FFmpeg可执行程序路径,支持相对路径/绝对路径
# Path to the FFmpeg executable. Both relative and absolute paths are supported.
bin=/usr/bin/ffmpeg
#FFmpeg拉流再推流的命令模板通过该模板可以设置再编码的一些参数
# FFmpeg拉流再推流的命令模板通过该模板可以设置诸如编码等的一些参数
# FFmpeg command template for pulling and re-publishing streams (used to define re-encoding parameters).
cmd=%s -re -i %s -c:a aac -strict -2 -ar 44100 -ab 48k -c:v libx264 -f flv %s
# FFmpeg生成截图的命令可以通过修改该配置改变截图分辨率或质量
# FFmpeg command template for generating snapshots. Modify this to change resolution or quality.
snap=%s -i %s -y -f mjpeg -frames:v 1 -an %s
# FFmpeg日志的路径如果置空则不生成FFmpeg日志
# 可以为相对(相对于本可执行程序目录)或绝对路径
# Path to the FFmpeg log file (relative or absolute). Leave empty to disable logging.
log=./ffmpeg/ffmpeg.log
# 自动重启的时间(秒), 默认为0, 也就是不自动重启. 主要是为了避免长时间ffmpeg拉流导致的不同步现象
# Automatic restart interval in seconds (0 to disable). Helps prevent A/V desync caused by prolonged FFmpeg stream pulling.
restart_sec=0
# 转协议相关开关如果addStreamProxy api和on_publish hook回复未指定转协议参数则采用这些配置项
# Protocol conversion default switches. Used if protocol conversions aren't specified via the `addStreamProxy` API or the `on_publish` webhook.
[protocol]
# 转协议时,是否开启帧级时间戳覆盖
# 0:采用源视频流绝对时间戳,不做任何改变
# 1:采用zlmediakit接收数据时的系统时间戳(有平滑处理)
# 2:采用源视频流时间戳相对时间戳(增长量),有做时间戳跳跃和回退矫正
# Frame-level timestamp override mode during protocol conversion:
# - 0: Use absolute timestamp from the source (no modification).
# - 1: Use ZLMediaKit system timestamp upon data reception (with smoothing).
# - 2: Use relative timestamp increments, with correction for jumps and backwards drifts.
modify_stamp=2
# 转协议是否开启音频
# Whether to enable audio output during protocol conversion.
enable_audio=1
#添加acc静音音频在关闭音频时此开关无效
# 添加AAC静音音频在关闭音频时此开关无效
# Whether to inject AAC silent audio (ignored if `enable_audio` is 0).
add_mute_audio=1
# 无人观看时,是否直接关闭(而不是通过on_none_reader hook返回close)
# 此配置置1时此流如果无人观看将不触发on_none_reader hook回调
# 而是将直接关闭流
# Whether to immediately close an unwatched stream directly instead of relying on the `on_none_reader` hook returning 'close'.
# If enabled (1), an unwatched stream is closed outright without triggering the hook callback.
auto_close=0
# 推流断开后可以在超时时间内重新连接上继续推流,这样播放器会接着播放。
# 置0关闭此特性(推流断开会导致立即断开播放器)
# 此参数不应大于播放器超时时间;单位毫秒
# Defines a grace period (in milliseconds) allowing a disconnected publisher to reconnect and resume streaming.
# During this period, active player connections are maintained rather than dropped.
# Set to 0 to disable this feature, which means dropping a publisher will immediately disconnect all its current players.
# This value must not exceed the player's configured timeout.
continue_push_ms=15000
# 平滑发送定时器间隔单位毫秒置0则关闭开启后影响cpu性能同时增加内存
# 该配置开启后可以解决一些流发送不平滑导致zlmediakit转发也不平滑的问题
# Smooth sending timer interval in milliseconds (0 to disable). Enabling this increases CPU and memory usage.
# This solves the issue where unsteady upstream publishing causes ZLMediaKit's forwarding to also be unsteady.
paced_sender_ms=0
# 是否开启转换为hls(mpegts)
# Whether to enable conversion to HLS (mpegts).
enable_hls=1
# 是否开启转换为hls(fmp4)
# Whether to enable conversion to HLS (fmp4).
enable_hls_fmp4=0
# 是否开启MP4录制
# Whether to enable MP4 recording.
enable_mp4=0
# 是否开启转换为rtsp/webrtc
# Whether to enable conversion to RTSP/WebRTC.
enable_rtsp=1
# 是否开启转换为rtmp/flv
# Whether to enable conversion to RTMP/FLV.
enable_rtmp=1
# 是否开启转换为http-ts/ws-ts
# Whether to enable conversion to HTTP-TS/WS-TS.
enable_ts=1
# 是否开启转换为http-fmp4/ws-fmp4
# Whether to enable conversion to HTTP-FMP4/WS-FMP4.
enable_fmp4=1
# 是否将mp4录制当做观看者
# Whether to treat MP4 recording tasks as active stream viewers.
mp4_as_player=0
# mp4切片大小单位秒
# Maximum duration of MP4 recording segments in seconds.
mp4_max_second=3600
# mp4录制保存路径
# Directory path for saving MP4 recordings.
mp4_save_path=./www
# hls录制保存路径
# Directory path for saving HLS recordings.
hls_save_path=./www
###### 以下是按需转协议的开关在测试ZLMediaKit的接收推流性能时请把下面开关置1
###### 如果某种协议你用不到你可以把以下开关置1以便节省资源(但是还是可以播放,只是第一个播放者体验稍微差点)
###### 如果某种协议你想获取最好的用户体验请置0(第一个播放者可以秒开,且不花屏)
###### 对于不使用的协议,可以将开关设置为 1 以节省资源(虽然首个播放者体验稍差,但依然可以播放)。
###### 对于希望获得最佳用户体验的协议,请设置为 0首屏秒开且无花屏现象
###### On-demand protocol conversion switches. Set these to 1 during stream reception performance testing to save resources.
###### For unused protocols, setting them to 1 saves resources (with a slight startup delay for the first viewer).
###### For the best user experience (instant playback and no visual artifacts (glitches)), set them to 0.
# hls协议是否按需生成如果hls.segNum配置为0(意味着hls录制)那么hls将一直生成(不管此开关)
# Whether to generate HLS streams on demand. If `hls.segNum` is configured to 0 (implies HLS recording), HLS streams generate continuously regardless of this switch.
hls_demand=0
# rtsp[s]协议是否按需生成
# Whether to generate RTSP[S] streams on demand.
rtsp_demand=0
# rtmp[s]、http[s]-flv、ws[s]-flv协议是否按需生成
# Whether to generate RTMP[S], HTTP[S]-FLV, and WS[S]-FLV streams on demand.
rtmp_demand=0
# http[s]-ts协议是否按需生成
# Whether to generate HTTP[S]-TS streams on demand.
ts_demand=0
# http[s]-fmp4、ws[s]-fmp4协议是否按需生成
# Whether to generate HTTP[S]-FMP4 and WS[S]-FMP4 streams on demand.
fmp4_demand=0
[general]
# 是否启用虚拟主机
# Whether to enable virtual hosting.
enableVhost=0
# 播放器或推流器在断开后会触发hook.on_flow_report事件(使用多少流量事件)
# flowThreshold参数控制触发hook.on_flow_report事件阈值使用流量超过该阈值后才触发单位KB
# When a player or publisher disconnects, it triggers the `hook.on_flow_report` event (an event reporting how much traffic was used).
# The `flowThreshold` parameter controls the threshold for triggering the `hook.on_flow_report` event; it is only triggered when the used traffic exceeds this threshold, in KB.
flowThreshold=1024
# 播放最多等待时间,单位毫秒
# 播放在播放某个流时,如果该流不存在,
# ZLMediaKit会最多让播放器等待maxStreamWaitMS毫秒
# 如果在这个时间内,该流注册成功,那么会立即返回播放器播放成功
# 否则返回播放器未找到该流,该机制的目的是可以先播放再推流
# Maximum playback wait time in milliseconds.
# When a requested stream does not exist, ZLMediaKit delays the player for up to `maxStreamWaitMS`.
# If the stream is successfully registered within this period, it immediately returns playback success.
# Otherwise, it returns 'stream not found'. This mechanism enables 'play before push' workflows.
maxStreamWaitMS=15000
# 某个流无人观看时触发hook.on_stream_none_reader事件的最大等待时间单位毫秒
# 在配合hook.on_stream_none_reader事件时可以做到无人观看自动停止拉流或停止接收推流
# The continuous unwatched duration (in ms) required to trigger the `hook.on_stream_none_reader` event.
# Combined with the `hook.on_stream_none_reader` event, this enables automatically stopping origin pulls or disconnecting publishers when a stream remains unwatched.
streamNoneReaderDelayMS=20000
# 拉流代理时如果断流再重连成功是否删除前一次的媒体流数据,如果删除将重新开始,
# 如果不删除将会接着上一次的数据继续写(录制hls/mp4时会继续在前一个文件后面写)
# Whether to flush cached media data upon successfully reconnecting after an origin pull proxy disconnection. If flushed, the stream restarts cleanly.
# If not flushed, the new data will append directly to the previous data (when recording HLS/MP4, it continues appending to the previous file).
resetWhenRePlay=1
# 合并写缓存大小(单位毫秒)合并写指服务器缓存一定的数据后才会一次性写入socket这样能提高性能但是会提高延时
# 开启后会同时关闭TCP_NODELAY并开启MSG_MORE
# Write coalescing cache duration in ms. The server caches data up to this interval before writing to the socket in bulk, improving performance at the cost of slight latency.
# Enabling this disables `TCP_NODELAY` and enables `MSG_MORE`.
mergeWriteMS=0
# 服务器唯一id用于触发hook时区别是哪台服务器
# Unique server ID, used to distinguish which server it is when triggering a hook.
mediaServerId=your_server_id
# 最多等待未初始化的Track时间单位毫秒超时之后会忽略未初始化的Track
# Maximum wait time (in ms) for uninitialized Tracks. After the timeout, any uninitialized Tracks will be ignored.
wait_track_ready_ms=10000
# 最多等待音频Track收到数据时间单位毫秒超时且完全没收到音频数据忽略音频Track
# 加快某些带封装的流metadata说明有音频但是实际上没有的流ready时间比如很多厂商的GB28181 PS
# Maximum wait time (in ms) before an audio track receives its first data packet. If it times out and absolutely no audio data has been received, the audio Track is ignored.
# This speeds up the ready time for certain packaged streams whose metadata falsely claims to include audio, but actually do not (e.g., GB28181 PS).
wait_audio_track_data_ms=1000
# 如果流只有单Track最多等待若干毫秒超时后未收到其他Track的数据则认为是单Track
# 如果协议元数据有声明特定track数那么无此等待时间
# Maximum wait time (in ms) for additional tracks if a stream currently has only one.
# If no data from other tracks is received within this timeout, it is considered a single-track stream.
# This delay is bypassed if protocol metadata explicitly declares the track count.
wait_add_track_ms=3000
# 如果track未就绪我们先缓存帧数据但是有最大个数限制防止内存溢出
# If a track is not ready, we first cache the frame data, but there is a maximum count limit to prevent memory overflow.
unready_frame_cache=100
# 是否启用观看人数变化事件广播置1则启用置0则关闭
# Whether to enable broadcasting of viewership change events. Set to 1 to enable, set to 0 to disable.
broadcast_player_count_changed=0
# 绑定的本地网卡ip
# Bound local network interface IP address.
listen_ip=::
[hls]
# hls写文件的buf大小调整参数可以提高文件io性能
# Buffer size used when writing HLS segment files. Increasing this value can improve disk I/O performance.
fileBufSize=65536
# hls最大切片时间
# Target maximum duration of a single HLS segment.
segDur=2
# m3u8索引中,hls保留切片个数(实际保留切片个数+segRetain个)
# 如果设置为0则不删除切片且m3u8文件全量记录切片列表
# Number of HLS segments retained within the m3u8 playlist index (actual chunks kept = this value + `segRetain`).
# Set to 0 to retain all segments and record the full segment list in the m3u8 file.
segNum=3
# HLS切片延迟个数大于0将生成hls_delay.m3u8文件0则不生成
# The segment delay count for HLS. If greater than 0, an `hls_delay.m3u8` variant playlist is generated; if 0, it will not be generated.
segDelay=0
# HLS切片从m3u8文件中移除后继续保留在磁盘上的个数
# Number of outdated HLS segments to keep on disk after removal from the m3u8 playlist.
segRetain=5
# 是否广播 hls切片(ts/fmp4)完成通知(on_record_ts)
# Whether to broadcast HLS segment (TS/FMP4) completion notifications via `on_record_ts`.
broadcastRecordTs=0
# 直播hls文件删除延时单位秒issue: #913
# Delay in seconds before deleting expired live HLS segments. Refer to issue: #913.
deleteDelaySec=10
# 此选项开启后m3u8文件还是表现为直播但是切片文件会被全部保留为点播用
# segDur设置为0或segKeep设置为1的情况下每个切片文件夹下会生成一个vod.m3u8文件用于点播该时间段的录像
# When enabled, the `m3u8` playlist functions as live media, but segment chunks are permanently preserved in storage for Video On Demand (VOD).
# If either `segKeep` is 1 or `segDur` is 0, a `vod.m3u8` playlist is also generated in each segment's folder for VOD playback of that specific recorded period.
segKeep=0
#如果设置为1则第一个切片长度强制设置为1个GOP。当GOP小于segDur可以提高首屏速度
fastRegister=0
# 如果设置为1则第一个切片长度强制设置为1个GOP。当GOP小于segDur可以提高首屏速度
# If set to 1, the length of the first segment is forcibly set to exactly 1 GOP.
# When the GOP is smaller than `segDur`, this can improve the initial startup (instant playback) speed.
fastRegister=0
[hook]
# 是否启用hook事件启用后推拉流都将进行鉴权
# Whether to enable webhook events. When enabled, pushing and pulling streams requires authentication.
enable=0
# 播放器或推流器使用流量事件,置空则关闭
# Player or publisher flow traffic event. Leave empty to disable.
on_flow_report=
# 访问http文件鉴权事件置空则关闭鉴权
# HTTP file access authentication event. Leave empty to disable.
on_http_access=
# 播放鉴权事件,置空则关闭鉴权
# Playback authentication event. Leave empty to disable.
on_play=
# 推流鉴权事件,置空则关闭鉴权
# Publishing authentication event. Leave empty to disable.
on_publish=
# 录制mp4切片完成事件
# MP4 segment recording completion event.
on_record_mp4=
# 录制 hls ts(或fmp4) 切片完成事件
# HLS TS (or fmp4) segment recording completion event.
on_record_ts=
# rtsp播放鉴权事件此事件中比对rtsp的用户名密码
# RTSP playback authentication event (used to verify RTSP username and password).
on_rtsp_auth=
# rtsp播放是否开启专属鉴权事件置空则关闭rtsp鉴权。rtsp播放鉴权还支持url方式鉴权
# 建议开发者统一采用url参数方式鉴权rtsp用户名密码鉴权一般在设备上用的比较多
# 开启rtsp专属鉴权后将不再触发on_play鉴权事件
# Whether to enable a dedicated RTSP realm authentication event (leave empty to disable; URL-based auth remains supported).
# We recommend standardizing on URL parameters; RTSP username/password auth is mostly for hardware devices.
# Enabling this bypasses the standard `on_play` webhook.
on_rtsp_realm=
# 远程telnet调试鉴权事件
# Remote telnet debugging authentication event.
on_shell_login=
# 直播流注册或注销事件
# Live stream registration or unregistration event.
on_stream_changed=
# 过滤on_stream_changed hook的协议类型可以选择只监听某些感兴趣的协议置空则不过滤协议
# Filter the protocol types for the `on_stream_changed` hook to listen only to specific protocols. Leave empty to disable filtering.
stream_changed_schemas=rtsp/rtmp/fmp4/ts/hls/hls.fmp4
# 无人观看流事件通过该事件可以选择是否关闭无人观看的流。配合general.streamNoneReaderDelayMS选项一起使用
# Triggered when a stream has no viewers. Combined with `general.streamNoneReaderDelayMS`, this enables closing unwatched streams.
on_stream_none_reader=
# 播放时未找到流事件通过配合hook.on_stream_none_reader事件可以完成按需拉流
# Triggered when a requested stream is not found. Combined with `hook.on_stream_none_reader`, this enables on-demand origin pulling.
on_stream_not_found=
# 服务器启动报告,可以用于服务器的崩溃重启事件监听
# Server startup report. Useful for monitoring server crashes and restarts.
on_server_started=
# 服务器退出报告,当服务器正常退出时触发
# Server exit report, triggered when the server shuts down normally.
on_server_exited=
# server保活上报
# Server keep-alive reporting event.
on_server_keepalive=
# 发送rtp(startSendRtp)被动关闭时回调
# Callback triggered when RTP sending (`startSendRtp`) is passively closed.
on_send_rtp_stopped=
# rtp server 超时未收到数据
# RTP server timeout event due to not receiving data.
on_rtp_server_timeout=
# hook api最大等待回复时间单位秒
# Maximum wait time in seconds for Webhook API responses.
timeoutSec=10
# keepalive hook触发间隔,单位秒float类型
# Interval in seconds (float) for triggering the keep-alive webhook.
alive_interval=10.0
# hook通知失败重试次数,正整数。为0不重试1时重试一次以此类推
# Webhook notification failure retry attempts. Must be a non-negative integer (0 to disable).
retry=1
# hook通知失败重试延时单位秒float型
# Delay in seconds (float) between webhook retry attempts.
retry_delay=3.0
[cluster]
@ -219,226 +374,339 @@ retry_delay=3.0
# hls方式: http://127.0.0.1:80/%s/%s/hls.m3u8
# http-ts方式: http://127.0.0.1:80/%s/%s.live.ts
# 支持多个源站,不同源站通过分号(;)分隔
# Origin pull URL template (printf style: first `%s` is app, second `%s` is stream_id).
# When cluster mode is enabled, `on_stream_not_found` and `on_stream_none_reader` webhooks are disabled.
# Supported origin pull protocols:
# RTMP mode: rtmp://127.0.0.1:1935/%s/%s
# RTSP mode: rtsp://127.0.0.1:554/%s/%s
# HLS mode: http://127.0.0.1:80/%s/%s/hls.m3u8
# HTTP-TS mode: http://127.0.0.1:80/%s/%s.live.ts
# Separate multiple origin servers with semicolons (;).
origin_url=
# 溯源总超时时长单位秒float型假如源站有3个那么单次溯源超时时间为timeout_sec除以3
# 单次溯源超时时间不要超过general.maxStreamWaitMS配置
# Total origin pull timeout in seconds (float).
# The single origin attempt timeout (total timeout divided by the number of origins) should not exceed `general.maxStreamWaitMS`.
timeout_sec=15
# 溯源失败尝试次数,-1时永久尝试
# Failure retry attempts for origin pulling (-1 for infinite retries).
retry_count=3
[http]
# http服务器字符编码集
# HTTP server character encoding.
charSet=utf-8
# http链接超时时间
# HTTP connection timeout in seconds.
keepAliveSecond=30
# http请求体最大字节数如果post的body太大则不适合缓存body在内存
# Maximum number of bytes for the HTTP request body. If the POST body is too large, it is not suitable to cache the body in memory.
maxReqSize=40960
# 404网页内容用户可以自定义404网页
# Custom 404 page content. Users can customize the 404 response page here.
#notFound=<html><head><title>404 Not Found</title></head><body bgcolor="white"><center><h1>您访问的资源不存在!</h1></center><hr><center>ZLMediaKit-4.0</center></body></html>
# http服务器监听端口
# HTTP server listening port.
port=80
# http文件服务器根目录
# 可以为相对(相对于本可执行程序目录)或绝对路径
# HTTP file server root directory (relative or absolute path).
rootPath=./www
# http文件服务器读文件缓存大小单位BYTE调整该参数可以优化文件io性能
# HTTP file server read cache size in bytes. Tweak to optimize file I/O performance.
sendBufSize=65536
# https服务器监听端口
# HTTPS server listening port.
sslport=443
# 是否显示文件夹菜单,开启后可以浏览文件夹
# Whether to enable directory browsing menus.
dirMenu=1
# 虚拟目录, 虚拟目录名和文件路径使用","隔开,多个配置路径间用";"隔开
# 例如赋值为 app_a,/path/to/a;app_b,/path/to/b 那么
# 访问 http://127.0.0.1/app_a/file_a 对应的文件路径为 /path/to/a/file_a
# 访问 http://127.0.0.1/app_b/file_b 对应的文件路径为 /path/to/b/file_b
# 访问其他http路径,对应的文件路径还是在rootPath内
# Virtual directory mappings. Format: virtual_name,path;virtual_name,path (name and file path separated by ",", multiple mappings separated by ";").
# For example, set `app_a,/path/to/a;app_b,/path/to/b` then:
# Accessing `http://127.0.0.1/app_a/file_a` maps to `/path/to/a/file_a`.
# Accessing `http://127.0.0.1/app_b/file_b` maps to `/path/to/b/file_b`, while other HTTP paths still map to files under `rootPath`.
virtualPath=
# 禁止后缀的文件使用mmap缓存使用“,”隔开
# 例如赋值为 .mp4,.flv
# 那么访问后缀为.mp4与.flv 的文件不缓存
# Disables `mmap` caching for specific file extensions. Use `,` to separate multiple extensions.
# Example: `.mp4,.flv` means files with these extensions bypass the `mmap` cache.
forbidCacheSuffix=
# 可以把http代理前真实客户端ip放在http头中https://github.com/ZLMediaKit/ZLMediaKit/issues/1388
# 切勿暴露此key否则可能导致伪造客户端ip
# Header name to trust for extracting the real client IP from an HTTP proxy request header. See: https://github.com/ZLMediaKit/ZLMediaKit/issues/1388
# Do not expose this key, as it may lead to forged client IPs.
forwarded_ip_header=
# 默认允许所有跨域请求
# Whether to allow all cross-origin requests by default (sets generic CORS headers).
allow_cross_domains=1
# 允许访问http api和http文件索引的ip地址范围白名单置空情况下不做限制
# IP whitelist ranges allowed to access the HTTP API and file indexes. Leave empty to allow any IP without restrictions.
allow_ip_range=::1,127.0.0.1,172.16.0.0-172.31.255.255,192.168.0.0-192.168.255.255,10.0.0.0-10.255.255.255
[multicast]
# rtp组播截止组播ip地址
# Maximum IP address for the multicast pool.
addrMax=239.255.255.255
# rtp组播起始组播ip地址
# Minimum IP address for the multicast pool.
addrMin=239.0.0.0
# 组播udp ttl
# TTL (Time to Live) for multicast UDP packets.
udpTTL=64
[record]
# mp4录制或mp4点播的应用名通过限制应用名可以防止随意点播
# 点播的文件必须放置在此文件夹下
# Application name for MP4 recording/VOD. Restricting this prevents unauthorized VOD access.
# VOD files must be placed within this specific folder.
appName=record
# mp4录制写文件缓存单位BYTE,调整参数可以提高文件io性能
# MP4 recording write cache size in bytes. Tweak to optimize file I/O performance.
fileBufSize=65536
# mp4点播每次流化数据量单位毫秒
# 减少该值可以让点播数据发送量更平滑增大该值则更节省cpu资源
# Duration (in ms) of MP4 data streamed per VOD transmission block.
# Decreasing this value smooths transmission; increasing it saves CPU resources.
sampleMS=500
# mp4录制完成后是否进行二次关键帧索引写入头部
# Whether to write a secondary keyframe index into the MP4 header after recording completes (fast start).
fastStart=0
# MP4点播(rtsp/rtmp/http-flv/ws-flv)是否循环播放文件
# Controls whether MP4 VOD playback (rtsp/rtmp/http-flv/ws-flv) loops the file when it reaches the end.
fileRepeat=0
# MP4录制写文件格式是否采用fmp4启用的话断电未完成录制的文件也能正常打开
# Whether to use the fmp4 format for MP4 recording. Enables normal playback of interrupted recordings (e.g., due to power loss).
enableFmp4=0
[rtmp]
# rtmp必须在此时间内完成握手否则服务器会断开链接单位秒
# RTMP handshake timeout in seconds. The server drops the connection if not completed.
handshakeSecond=15
# rtmp超时时间如果该时间内未收到客户端的数据
# 或者tcp发送缓存超过这个时间则会断开连接单位秒
# RTMP keep-alive timeout in seconds. Connections drop if no data from the client is received,
# or if the TCP send buffer stall exceeds this duration.
keepAliveSecond=15
# rtmp服务器监听端口
# RTMP server listening port.
port=1935
# rtmps服务器监听地址
# RTMPS server listening port.
sslport=0
# rtmp是否直接代理模式
# Whether to enable direct proxy mode for RTMP.
directProxy=1
# h265/opus/vp8/vp9/av1 rtmp打包采用增强型rtmp标准还是国内拓展标准
# Whether RTMP packaging for H265/Opus/VP8/VP9/AV1 uses the Enhanced RTMP standard (1) or the domestic extended standard (0).
enhanced=1
[rtp]
# 音频mtu大小该参数限制rtp最大字节数推荐不要超过1400
# 加大该值会明显增加直播延时
# Audio MTU size (restricts max RTP payload in bytes). We recommend keeping this <= 1400.
# Increasing this value significantly increases live streaming latency.
audioMtuSize=600
# 视频mtu大小该参数限制rtp最大字节数推荐不要超过1400
# Video MTU size (restricts max RTP payload in bytes). We recommend keeping this <= 1400.
videoMtuSize=1400
# rtp包最大长度限制单位KB,主要用于识别TCP上下文破坏时获取到错误的rtp
# Max RTP packet length in KB. Mainly used to identify receiving wrong RTP packets when TCP stream contexts are corrupted.
rtpMaxSize=10
# rtp 打包时低延迟开关默认关闭为0h264存在一帧多个sliceNAL的情况在这种情况下如果开启可能会导致画面花屏
# Low-latency mode for RTP packaging (disabled by default). Enabling this for H.264 video with multiple slices per frame may cause visual artifacts (glitches).
lowLatency=0
# H264 rtp打包模式是否采用stap-a模式(为了在老版本浏览器上兼容webrtc)还是采用Single NAL unit packet per H.264 模式
# 有些老的rtsp设备不支持stap-a rtp设置此配置为0可提高兼容性
# Whether H.264 RTP packaging uses the `stap-a` mode (for older WebRTC browser compatibility) or the `Single NAL unit packet per H.264` mode.
# Set this to 0 to improve compatibility with legacy RTSP devices that do not support `stap-a`.
h264_stap_a=1
[rtp_proxy]
# 导出调试数据(包括rtp/ps/h264)至该目录,置空则关闭数据导出
# Directory for exporting debugging data (rtp/ps/h264). Leave empty to disable.
dumpDir=
# udp和tcp代理服务器支持rtp(必须是ts或ps类型)代理
# UDP/TCP proxy server listening port. Supports RTP proxying (must be TS or PS).
port=10000
# rtp超时时间单位秒
# RTP timeout in seconds.
timeoutSec=15
# 随机端口范围最少确保36个端口
# 该范围同时限制rtsp服务器udp端口范围
# Random port range (ensure at least 36 ports).
# This also restricts the UDP port range for the RTSP server.
port_range=30000-35000
# rtp h264 负载的pt
# RTP payload type (PT) for H.264.
h264_pt=98
# rtp h265 负载的pt
# RTP payload type (PT) for H.265.
h265_pt=99
# rtp ps 负载的pt
# RTP payload type (PT) for PS.
ps_pt=96
# rtp opus 负载的pt
# RTP payload type (PT) for Opus.
opus_pt=100
# startSendRtp、startRecord相关功能是否提前开启gop缓存优化级联秒开体验默认开启, 并缓存1个GOP
# 如果不调用startSendRtp、startRecord后相关接口可以置0节省内存如果缓存多个gop可以加大该参数
# Whether to pre-enable GOP caching for `startSendRtp` and `startRecord` to optimize instant playback for cascaded streams. Enabled by default, caching 1 GOP.
# If these functions are unused, set to 0 to save memory; to cache multiple GOPs, increase this value.
gop_cache=1
# 国标发送g711 rtp 打包时每个包的语音时长是多少默认是100 ms范围为20~180ms (gb28181-2016c.2.4规定)
# 最好为20 的倍数程序自动向20的倍数取整
# Audio duration (in ms) per packet when packaging G.711 RTP for GB standards. Defaults to 100 ms (range: 20~180ms per gb28181-2016, c.2.4).
# A multiple of 20 is recommended; the program auto-rounds to the nearest multiple.
rtp_g711_dur_ms=100
# udp接收数据socket buffer大小配置
# 4*1024*1024=4196304
# Socket buffer size for receiving UDP data.
udp_recv_socket_buffer=4194304
# ps/ts解析后是否等待下一帧以判断本帧是否完整开启后提高兼容性但是可能增加延时
# Whether to wait for the next frame after parsing PS/TS to verify frame completeness. Improves compatibility but may increase latency.
merge_frame=1
[rtc]
# webrtc 信令服务器端口
# WebRTC signaling server port.
signalingPort=3000
signalingSslPort=3001
# STUN/TURN服务器端口
# STUN/TURN server port.
icePort=3478
iceTcpPort=3478
# STUN/TURN端口是否使能TURN服务
# Whether to enable TURN services on the STUN/TURN ports.
enableTurn=1
# ICE传输策略0=不限制(默认)1=仅支持Relay转发2=仅支持P2P直连
# ICE transport policy: 0 (No restrictions, default), 1 (Relay forwarding only), 2 (P2P direct connection only).
iceTransportPolicy=0
# STUN/TURN 服务Ice密码
# ICE credentials for STUN/TURN services.
iceUfrag=ZLMediaKit
icePwd=ZLMediaKit
# webrtc datachannel是否回显数据测试用
# Whether WebRTC Datachannel echoes received data (used for testing).
datachannel_echo=1
max_stun_retry=7
# TURN服务分配端口池
# Port range allocated for TURN services.
port_range=49152-65535
# rtc播放推流、播放超时时间
# Timeout in seconds for RTC stream publishing and playback.
timeoutSec=15
# 本机对rtc客户端的可见ip作为服务器时一般为公网ip可有多个用','分开当置空时会自动获取网卡ip
# 同时支持环境变量,以$开头,如"$EXTERN_IP"; 请参考https://github.com/ZLMediaKit/ZLMediaKit/pull/1786
# IP address(es) visible to RTC clients (typically public IPs). Separate multiple IPs with commas (',').
# Leave empty to auto-acquire network card IPs. Also supports env vars starting with `$`, e.g., `"$EXTERN_IP"`; please refer to: https://github.com/ZLMediaKit/ZLMediaKit/pull/1786
externIP=
# 当指定了interfaces,ICE服务器会使用指定网卡bind socket
# 以解决公网IP使用弹性公网IP配置实现(部署机器无法bind该公网ip的问题)
# 支持环境变量,以$开头,如"$PRIVATE_IP"
# If specified, the ICE server binds the socket to this specific network card.
# Solves binding issues on machines with Elastic Public IPs that cannot directly bind the public IP.
# Supports environment variables starting with `$`, e.g., `"$PRIVATE_IP"`.
interfaces=
# rtc udp服务器监听端口号所有rtc客户端将通过该端口传输stun/dtls/srtp/srtcp数据
# 该端口是多线程的,同时支持客户端网络切换导致的连接迁移
# 需要注意的是如果服务器在nat内需要做端口映射时必须确保外网映射端口跟该端口一致
# RTC UDP server listening port. Handles STUN/DTLS/SRTP/SRTCP data for all RTC clients.
# Multi-threaded and supports connection migration during client network switching.
# Note: For deployment behind a NAT, the external mapped port MUST match this port exactly.
port=8000
# rtc tcp服务器监听端口号在udp 不通的情况下会使用tcp传输数据
# 该端口是多线程的,同时支持客户端网络切换导致的连接迁移
# 需要注意的是如果服务器在nat内需要做端口映射时必须确保外网映射端口跟该端口一致
# RTC TCP server listening port. Used as a fallback if UDP is unreachable.
# Multi-threaded and supports connection migration during client network switching.
# Note: For deployment behind a NAT, the external mapped port MUST match this port exactly.
tcpPort=8000
# 设置remb比特率非0时关闭twcc并开启remb。该设置在rtc推流时有效可以控制推流画质
# 目前已经实现twcc自动调整码率关闭remb根据真实网络状况调整码率
# REMB bitrate threshold. Non-zero values disable TWCC and enable REMB (effective for RTC publishing to control picture quality).
# ZLMediaKit natively supports automatic TWCC bitrate adjustment; disabling REMB allows rates to adjust naturally based on actual network conditions.
rembBitRate=0
# rtc支持的音频codec类型,在前面的优先级更高
# 以下范例为所有支持的音频codec
# Supported RTC audio codecs (listed in descending priority).
preferredCodecA=PCMA,PCMU,opus,mpeg4-generic
# rtc支持的视频codec类型,在前面的优先级更高
# 以下范例为所有支持的视频codec
# Supported RTC video codecs (listed in descending priority).
preferredCodecV=H264,H265,AV1,VP9,VP8
# webrtc比特率设置
# WebRTC bitrate settings.
start_bitrate=0
max_bitrate=0
min_bitrate=0
# nack接收端, rtp发送端zlm发送rtc流
# rtp重发缓存列队最大长度单位毫秒
# NACK receiver / RTP sender queue (ZLM sending RTC streams).
# Maximum length of the RTP retransmission cache queue in ms.
maxRtpCacheMS=5000
# rtp重发缓存列队最大长度单位个数
# Maximum length of the RTP retransmission cache queue in packet count.
maxRtpCacheSize=2048
# nack发送端rtp接收端zlm接收rtc推流
# 最大保留的rtp丢包状态个数
# NACK sender / RTP receiver queue (ZLM receiving RTC streams).
# Maximum number of retained RTP packet-loss states.
nackMaxSize=2048
# rtp丢包状态最长保留时间
# Maximum retention time for RTP packet-loss states in ms.
nackMaxMS=3000
# nack最多请求重传次数
# Maximum number of NACK retransmission requests.
nackMaxCount=15
# nack重传频率rtt的倍数
# NACK retransmission frequency (multiple of RTT).
nackIntervalRatio=1.0
# 视频nack包中rtp个数减小此值可以让nack包响应更灵敏
# Number of RTP packets in a video NACK packet. Lower values make NACK responses more sensitive.
nackRtpSize=8
# 音频nack包中rtp个数减小此值可以让nack包响应更灵敏
# Number of RTP packets in an audio NACK packet. Lower values make NACK responses more sensitive.
nackAudioRtpSize=4
# 是否尝试过滤 b帧
# Whether to attempt filtering out B-frames.
bfilter=0
# 是否优先采用webrtc over tcp模式
# Whether to prioritize WebRTC over TCP mode.
preferred_tcp=0
[srt]
# srt播放推流、播放超时时间,单位秒
# Timeout in seconds for SRT stream publishing and playback.
timeoutSec=5
# srt udp服务器监听端口号所有srt客户端将通过该端口传输srt数据
# 该端口是多线程的,同时支持客户端网络切换导致的连接迁移
# SRT UDP server listening port. Handles SRT data for all clients.
# Multi-threaded and supports connection migration during client network switching.
port=9000
# srt 协议中延迟缓存的估算参数在握手阶段估算rtt ,然后latencyMul*rtt 为最大缓存时长,此参数越大,表示等待重传的时长就越大
# SRT protocol delay buffer estimation parameter. Handshake estimated `RTT * latencyMul` sets the maximum buffer duration. Larger values increase wait times for retransmissions.
latencyMul=4
# 包缓存的大小
# Packet buffer size.
pktBufSize=8192
# srt udp服务器的密码,为空表示不加密
# SRT UDP server password (leave empty to disable encryption).
passPhrase=
[rtsp]
# rtsp专有鉴权方式是采用base64还是md5方式
# Whether RTSP dedicated authentication uses base64 or md5.
authBasic=0
# rtsp拉流、推流代理是否是直接代理模式
# 直接代理后支持任意编码格式但是会导致GOP缓存无法定位到I帧可能会导致开播花屏
@ -447,29 +715,47 @@ authBasic=0
# 如果你是rtsp推拉流但是webrtc播放也建议关闭直接代理模式
# 因为直接代理时rtp中可能没有sps pps,会导致webrtc无法播放; 另外webrtc也不支持Single NAL Unit Packets类型rtp
# 默认开启rtsp直接代理rtmp由于没有这些问题是强制开启直接代理的
# Whether to enable direct proxy mode for RTSP pulling/publishing.
# Direct proxying supports any codec but bypasses GOP cache I-frame detection, potentially causing initial visual artifacts.
# Furthermore, if pulling via TCP, an RTP payload exceeding the MTU will make UDP proxying unusable.
# Assuming your pull source format is not H264, H265, or AAC, you can use direct proxy mode to support RTSP proxying.
# If you are pulling/pushing via RTSP but playing via WebRTC, it is also recommended to disable direct proxy mode;
# this is because direct proxies may drop SPS/PPS (preventing WebRTC playback), and WebRTC does not support `Single NAL Unit Packets` RTP.
# RTSP direct proxy is enabled by default. RTMP natively enforces direct proxying because it lacks these issues.
directProxy=1
# rtsp必须在此时间内完成握手否则服务器会断开链接单位秒
# RTSP handshake timeout in seconds. The server drops the connection if not completed.
handshakeSecond=15
# rtsp超时时间如果该时间内未收到客户端的数据
# 或者tcp发送缓存超过这个时间则会断开连接单位秒
# RTSP keep-alive timeout in seconds. Connections drop if no data is received or if the TCP send buffer stalls for this duration.
keepAliveSecond=15
# rtsp服务器监听地址
# RTSP server listening port.
port=554
# rtsps服务器监听地址
# RTSPS server listening port.
sslport=0
# rtsp 转发是否使用低延迟模式当开启时不会缓存rtp包来提高并发可以降低一帧的延迟
# Whether RTSP forwarding uses low-latency mode. Skips RTP packet caching to improve concurrency and reduce latency by one frame.
lowLatency=0
# 强制协商rtp传输方式 (0:TCP,1:UDP,2:MULTICAST,-1:不限制)
# 当客户端发起RTSP SETUP的时候如果传输类型和此配置不一致则返回461 Unsupported transport
# 迫使客户端重新SETUP并切换到对应协议。目前支持FFMPEG和VLC
# Force RTP transport negotiation type (0: TCP, 1: UDP, 2: MULTICAST, -1: No limits).
# When the client initiates RTSP SETUP, if the transport type conflicts with this configuration, it returns `461 Unsupported transport`.
# This forces the client to re-SETUP and switch to the corresponding protocol. Currently supports FFmpeg and VLC.
rtpTransportType=-1
[shell]
# 调试telnet服务器接受最大buffer大小
# Maximum buffer size accepted by the debugging Telnet server.
maxReqSize=1024
# 调试telnet服务器监听端口
# Debugging Telnet server listening port.
port=0
# onvif搜索用
# Used for ONVIF search.
[onvif]
port=3702

31
conf/readme_en.md Normal file
View File

@ -0,0 +1,31 @@
## Key parameters that affect performance in the configuration file
### 1. Protocol enable flags (e.g., protocol.enable_hls, protocol.enable_rtsp)
Controls the protocol conversion flags. Disabling unnecessary protocols will save CPU and memory resources.
### 2. On-demand protocol flags (e.g., protocol.hls_demand, protocol.rtsp_demand)
Controls on-demand protocol generation. When both this and the specific protocol are enabled, it saves CPU and memory when there are no active viewers. However, the first viewer will lose the instant playback capability, impacting the initial experience.
### 3. protocol.paced_sender_ms
The interval for the smooth sending timer. This helps address playback stuttering caused by irregular data transmission from the source. When enabled, the timer uses data timestamps to pace the transmission, improving the viewing experience.
However, this increases CPU and memory consumption. A shorter timer interval results in higher CPU usage but better smoothness. The recommended interval is between 30 and 100 milliseconds. For optimal results, use this feature in conjunction with setting `protocol.modify_stamp` to 2 (which suppresses timestamp jumps).
### 4. general.mergeWriteMS
Enables write coalescing, which reduces the number of system calls and the frequency of data sharing between threads during transmission. This significantly boosts forwarding performance but comes at the cost of increased playback latency and reduced transmission smoothness.
### 5. rtp_proxy.gop_cache
Enables the GOP (Group of Pictures) caching feature for the `startSendRtp` cascaded interface, designed to allow instant playback for cascading setups (e.g., GB28181). Note that this setting does not affect the instant playback capability of ZLMediaKit's external live streaming services.
Enabling this option increases memory usage but has a minimal impact on the CPU. We recommend disabling it if you don't use the `startSendRtp` interface.
### 6. hls.fileBufSize
Tuning this parameter can improve the disk I/O performance when writing HLS streams.
### 7. record.fileBufSize
Tuning this parameter can improve the disk I/O performance when recording MP4 files.