#!!!!此配置文件为范例配置文件，意在告诉读者，各个配置项的具体含义和作用，
#!!!!该配置文件在执行cmake时，会拷贝至release/${操作系统类型}/${编译类型}(例如release/linux/Debug) 文件夹。
#!!!!该文件夹(release/${操作系统类型}/${编译类型})同时也是可执行程序生成目标路径，在执行MediaServer进程时，它会默认加载同目录下的config.ini文件作为配置文件，
#!!!!你如果修改此范例配置文件(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

[ffmpeg]
# FFmpeg可执行程序路径,支持相对路径/绝对路径
# Path to the FFmpeg executable. Both relative and absolute paths are supported.
bin=/usr/bin/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

# 添加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（首屏秒开，且无花屏现象）。
###### 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，可以提高首屏速度
# 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]
# 设置源站拉流url模板, 格式跟printf类似，第一个%s指定app,第二个%s指定stream_id,
# 开启集群模式后，on_stream_not_found和on_stream_none_reader hook将无效.
# 溯源模式支持以下类型:
# rtmp方式: rtmp://127.0.0.1:1935/%s/%s
# rtsp方式: rtsp://127.0.0.1:554/%s/%s
# 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 打包时，低延迟开关，默认关闭（为0），h264存在一帧多个slice（NAL）的情况，在这种情况下，如果开启可能会导致画面花屏
# 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-2016，c.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帧，可能会导致开播花屏
# 并且如果是tcp方式拉流，如果rtp大于mtu会导致无法使用udp方式代理
# 假定您的拉流源地址不是264或265或AAC，那么你可以使用直接代理的方式来支持rtsp代理
# 如果你是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
