N
O
D
E
M
E
D
I
A
Thinking
首页
产品
文档
博客
订单
文档
配置说明
2026年 5月 20日 下午3:36
## common ### license 授权码,程序运行后,将Machine ID值发给客服进行授权 ``` license = ``` ### http_api http_api 是否开启http_api功能, 默认关闭. 需要开启http或https服务 ``` http_api = true ``` ### admin_panel admin_panel 是否开启后台管理面板,需要开启http或https服务 ``` admin_panel = true ``` ### notify_url ; notify_url 当流创建和结束时以POST方式通知到该url,当通知创建时返回非200状态码,将中断该流 ``` notify_url = http://192.168.0.8:8008/notify ``` ### gop_cache ; gop_cache 是否开启gop cache, 该功能缓存最近的一段视频gop,使客户端能立刻开始解码秒开。 ; 但在服务端有大量推流时需要更多的内存, 根据码率×原视频关键帧间隔×并发量来计算。 ``` gop_cache = true ``` ### web_root ``` ; web_root 提供/路径静态访问 web_root = ./html ``` ### ondemand_mode ``` ; ondemand_mode 按需模式, 开启后flv,kmp,fmp4协议在需要时才进行转换 ; 提升大并发推流性能,避免空转 ; 如果只使用rtmp协议, 或者做转发服务也可以打开 ; 只会影响第一次该协议播放客户端的首屏打开速度 ondemand_mode = false ``` ## log ### log_level ; trace, debug, info, warn, error ``` log_level = debug ``` ### log_file ; console or real log file path like ./log/nms.log ``` log_file = console ``` ### log_maxday ``` ; log max day log_maxday = 7 ``` ### log_todb ``` ; log to db log_todb = false ``` ## av ### transcode_audio ; 是否开启自动音频转码 ; RTMP/FLV/KMP/HLS协议播放自动转其它音频编码为AAC ``` transcode_audio = true ``` ### crypto_key ; 对传入的视频加密, 16字节密码 ; 视频加密后,rtmp/kmp/http-flv/websocket-flv协议支持, HLS协议不支持 ; 暂不支持帧内多层编码的流,x264 编码设置zerolatency时,需要额外设置 -x264-params sliced-threads=0 ; 暂只支持H264+AAC的流 ; 支持开启transcode_audio后转码为AAC的流 ``` ; crypto_key = qwerty1234567890 ``` ### crypto_rule ; 加密规则, app_name/stream_name , 可以用*通配 , 多个规则用|分隔 ; 默认为 */* ``` ; crypto_rule = vip/* ``` ### screenshot_path ; 截图保存路径 ``` screenshot_path = ./screenshot ``` ### screenshot_suffix ; 截图后缀 time, count 默认不设置则可通过流名称直接访问截图 ; http://server_ip:8000/live/stream.jpg ``` ; screenshot_suffix = time ``` ### screenshot_interval ; 截图最小间隔 ; 数字后跟随s,m,h,d 即表示多少秒,分钟,小时,天 ``` screenshot_interval = 1m ``` ### record_path ; 录像格式MP4,录制开始和结束时会发送notify(postRecord,doneRecord),录像后可通过http访问 ; http://server_ip:8000/record/live/stream/2020-07-12-10-51-25.mp4 ; record_path 录像保存路径, 不设置则不开启录像 ``` ; record_path = ./record ``` ### record_rule ; record_rule 录像匹配规则, 默认 */* 全部流录像, live/* live下的流才录像, 多个规则 | 分割 ``` record_rule = */* ``` ### record_maxtime ; record_maxtime 最大单个录像时长 m,h,d ; 不设置则一直录像,直到推流断开 ``` record_maxtime = 1h ``` ### record_filetype ; record_filetype 录像文件格式,可选mp4, fmp4 , ts, flv, hls ; mp4, fmp4录制的文件都是.mp4后缀, 区别是, mp4格式通过http可以快速开始播放, fmp4需要下完全部内容才开始播放 ; 录制过程中程序异常退出, mp4没有时机写入结尾导致无法播放, 而fmp4可以正常播放 ; 录制开始和结束时会发送notify(postRecord,doneRecord),用于记录录制的文件名, 录像后可通过http访问 ; http://server_ip:8000/record/live/stream/2020-07-12-10-51-25.mp4 ; http://server_ip:8000/record/live/stream/2020-07-12-10-51-25.flv ; http://server_ip:8000/record/live/stream/2020-07-12-10-51-25.ts ; 需要注意的是hls格式录制, 因为录制中会产生大量ts文件(每分钟一个), 为了方便管理, 路径是 /live/stream/生成日期/index.m3u8 ; http://server_ip:8000/record/live/stream/2020-07-12-10-51-25/index.m3u8 ``` record_filetype = hls ``` ## auth ### auth_key ; 鉴权密码,鉴权码生成规则 ; 原地址 rtmp://192.168.0.8/live/stream ; 加密算法 先获取有效期时间戳(当前时间+30秒过期)1574318274,md5(/live/stream-1574318274-authkey@2019) ; 最终地址 rtmp://192.168.0.8/live/stream?sign=1574318274-5a1ee174233631793a4091badf4ffec5 ``` auth_key = authkey@2019 ``` ### auth_play ; 播放鉴权开关 ``` auth_play = false ``` ### auth_push ; 推流鉴权开关 ``` auth_push = false ``` ### auth_api ; API鉴权开关,打开后所有api调用需要设置header['authorization'] = login成功后返回的token ``` auth_api = true ``` ### auth_api_user ; API鉴权用户名,login时以json格式提交 { "username": "admin", "password": "21232f297a57a5a743894a0e4a801fc3" } ``` auth_api_user = admin ``` ### auth_api_pass ; API鉴权密码,login时需要传md5后的值 ``` auth_api_pass = admin ``` ### auth_domain ;auth_domain 验证域名,开启后,只有使用该域名访问才被允许,多个以|分隔 ``` auth_domain = live.nodemedia.cn ``` ## rtmp ### port ; rtmp协议端口 ``` port = 1935 ``` ## http ### port ; http-flv/websocket-flv协议端口 ; API接口,AdminPanel复用该端口 ``` port = 8000 ``` ### add_header ; add_header 添加自定义http头,用于特殊场景的需要. | 分开多条设定. ; NMS默认Access-Control-Allow-Origin为*, 在此设置后可覆盖设定做防盗链 ; add_header = Cross-Origin-Opener-Policy: same-origin | Cross-Origin-Embedder-Policy: require-corp ``` add_header = Access-Control-Allow-Origin: http://live.nodemedia.cn ``` ## https ### port ; https-flv/wss-flv 协议端口 ``` port = 8443 ``` ### key_file ``` key_file = key.pem ``` ### cert_file ``` cert_file = cert.pem ``` ## hls hls在默认配置文件中未开启,若需要请手动开启。 ; hls_path 切片临时存放路径, 必须填入有效且可写入的路径. 若不设置,则不会生成hls切片 ; hls_time 切片时间, 单位秒, 默认2 ; 经过这段时间后,将在下一个关键帧上剪切片段. 并不代表肯定会以这个设定值而切片,还要根据关键帧间隔而定. ; 低切片可有效降低hls延迟, 但也需要推流端使用固定的低关键帧间隔编码, 如果不固定关键帧间隔,会造成视频卡顿 ; hls_list 最大播放条目, 默认3 ``` ; hls_path = hls hls_time = 2 hls_list = 3 ``` ## kmp kmp协议绑定UDP端口监听 ``` ; port 端口号 port = 6935 ``` ## jt1078 nms仅作为流媒体服务端,还需要配合SIP服务,通知JT车载设备,设置直播流的服务端ip和一下端口 ``` ; jt1078 子码率配置端口 ; sub_port = 6660 ; jt1078 主码流配置端口 ; main_port = 6661 ; jt1078 单音频监听流配置端口 ; audio_port = 6602 ``` ## gb28181 ``` ; sip_id SIP服务器ID sip_id = 34020000002000000001 ; sip_domain SIP服务器域 sip_domain = 3402000000 ; sip_ip SIP服务器地址 sip_ip = 192.168.0.6 ; sip_port SIP服务器端口,UDP sip_port = 5060 ; sip_pass SIP服务器认证密码 sip_pass = 123456 ; rtp_port RTP服务器复用端口,UDP rtp_port = 5080 ``` ## rtsp ``` ; port rtsp协议tcp端口, ffmpeg,vlc等播放器默认使用tcp传输协议,udp传输rtp媒体数据 ; ffmpeg 使用 -rtsp_transport tcp 则rtsp协议和rtp数据都通过单一tcp端口传输 ; vlc 使用命令行加参数设置tcp传输 /usr/bin/vlc --rtsp-tcp rtsp://localhost/live/2 ; 使用tcp传输的好处是 1:单一网络端口开放, 2:公网传输不花屏 ; 对应播放和推流地址规范与rtmp一样, 也支持鉴权参数 ; rtsp://localhost:8554/live/stream ; rtsp://localhost:8554/live/stream?sign=1671694080-64669b5d4b147ac09dc6ec42ef79815d ; 支持h264/h265+aac/opus/g.711 编码 ; 推流和播放h265无需像rtmp和http-flv打补丁 port = 8554 ; RTP port , RTP通过UDP传输时,复用该端口, 该端口必须是偶数 rtp_port = 8002 ; RTCP port, RTCP通过UDP传输时,复用该端口, 该端口比RTP_PORT大1 rtcp_port = 8003 ``` ## webrtc ``` # WebRTC-HTTP ingestion protocol (WHIP) https://www.ietf.org/archive/id/draft-ietf-wish-whip-09.html # WebRTC-HTTP Egress Protocol (WHEP) https://www.ietf.org/archive/id/draft-murillo-whep-02.html # 使用whip和whep标准协议实现webrtc直接推流和播放, 信令使用http,https端口通信 # 请求地址格式为: # 推流 -- http://server_ip:8000/live/stream.whip # ip 服务部署在公网,设置公网IP地址,内网就填内网ip,使用此IP地址直接进行通讯, 如不设置使用stun识别 ip = # port ice监听复用端口,设置后开启服务,此端口用于传输媒体数据,单端口tcp/udp,注意开启防火墙 port = 0 # ice_tcp ice是否通过tcp传输, Chrome支持\OBS不支持 ice_tcp = false # stun 服务器地址, 多个服务器地址用 | 分割 stun = stun:stun.l.google.com:19302 ``` ## cluster ``` # 快速配置集群 # type 集群类型 # pull型, 该服务为edge, 按需去中心拉取 # push型, 该服务为centre, 主动推到边缘 type = pull # node 远端节点,需设置协议头,ip地址,端口号, 对接NMS可以用kmp协议 node = # args 参数 args = ```
嘿,我是小R,需要帮助随时找我哦
QQ客服:281269007
邮件支持
扫码加微信
回到顶部