SRS学习-配置DVR
SRS学习-配置DVR
介绍
硬盘录像机(Digital Video Recorder,简称DVR),即数字视频录像机,相对于传统的模拟视频录像机,采用硬盘录像,故常常被称为硬盘录像机,也被称为DVR。
它是一套进行图像存储处理的计算机系统,具有对图像/语音进行长时间录像、录音、远程监视和控制的功能。DVR采用的是数字记录技术,在图像处理、图像储存、检索、备份、以及网络传递、远程控制等方面也远远优于模拟监控设备,DVR代表了电视监控系统的发展方向,是市面上电视监控系统的首选产品。
之前介绍了如何配置SRS服务,现在需要将摄像头数据存储到硬盘中,作为历史数据方便后续查看。
SRS服务中已经集成了DVR功能,我们可以进行简单的配置来开启服务。
配置DVR
SRS-DVR官方文档
DVR的配置文件:
vhost your_vhost {# DVR RTMP stream to file,# start to record to file when encoder publish,# reap flv/mp4 according by specified dvr_plan.dvr {# whether enabled dvr features# default: offenabled on;# the filter for dvr to apply to.# all, dvr all streams of all apps.# <app>/<stream>, apply to specified stream of app.# for example, to dvr the following two streams:# live/stream1 live/stream2# default: alldvr_apply all;# the dvr plan. canbe:# session reap flv/mp4 when session end(unpublish).# segment reap flv/mp4 when flv duration exceed the specified dvr_duration.# @remark The plan append is removed in SRS3+, for it's no use.# default: sessiondvr_plan session;# the dvr output path, *.flv or *.mp4.# we supports some variables to generate the filename.# [vhost], the vhost of stream.# [app], the app of stream.# [stream], the stream name of stream.# [2006], replace this const to current year.# [01], replace this const to current month.# [02], replace this const to current date.# [15], replace this const to current hour.# [04], replace this const to current minute.# [05], replace this const to current second.# [999], replace this const to current millisecond.# [timestamp],replace this const to current UNIX timestamp in ms.# @remark we use golang time format "2006-01-02 15:04:05.999" as "[2006]-[01]-[02]_[15].[04].[05]_[999]"# for example, for url rtmp://ossrs.net/live/livestream and time 2015-01-03 10:57:30.776# 1. No variables, the rule of SRS1.0(auto add [stream].[timestamp].flv as filename):# dvr_path ./objs/nginx/html;# =># dvr_path ./objs/nginx/html/live/livestream.1420254068776.flv;# 2. Use stream and date as dir name, time as filename:# dvr_path /data/[vhost]/[app]/[stream]/[2006]/[01]/[02]/[15].[04].[05].[999].flv;# =># dvr_path /data/ossrs.net/live/livestream/2015/01/03/10.57.30.776.flv;# 3. Use stream and year/month as dir name, date and time as filename:# dvr_path /data/[vhost]/[app]/[stream]/[2006]/[01]/[02]-[15].[04].[05].[999].flv;# =># dvr_path /data/ossrs.net/live/livestream/2015/01/03-10.57.30.776.flv;# 4. Use vhost/app and year/month as dir name, stream/date/time as filename:# dvr_path /data/[vhost]/[app]/[2006]/[01]/[stream]-[02]-[15].[04].[05].[999].flv;# =># dvr_path /data/ossrs.net/live/2015/01/livestream-03-10.57.30.776.flv;# 5. DVR to mp4:# dvr_path ./objs/nginx/html/[app]/[stream].[timestamp].mp4;# =># dvr_path ./objs/nginx/html/live/livestream.1420254068776.mp4;# @see https://github.com/ossrs/srs/wiki/v4_CN_DVR#custom-path# @see https://github.com/ossrs/srs/wiki/v4_CN_DVR#custom-path# segment,session apply it.# default: ./objs/nginx/html/[app]/[stream].[timestamp].flvdvr_path ./objs/nginx/html/[app]/[stream].[timestamp].flv;# the duration for dvr file, reap if exceed, in seconds.# segment apply it.# session,append ignore.# default: 30dvr_duration 30;# whether wait keyframe to reap segment,# if off, reap segment when duration exceed the dvr_duration,# if on, reap segment when duration exceed and got keyframe.# segment apply it.# session,append ignore.# default: ondvr_wait_keyframe on;# about the stream monotonically increasing:# 1. video timestamp is monotonically increasing,# 2. audio timestamp is monotonically increasing,# 3. video and audio timestamp is interleaved monotonically increasing.# it's specified by RTMP specification, @see 3. Byte Order, Alignment, and Time Format# however, some encoder cannot provides this feature, please set this to off to ignore time jitter.# the time jitter algorithm:# 1. full, to ensure stream start at zero, and ensure stream monotonically increasing.# 2. zero, only ensure stream start at zero, ignore timestamp jitter.# 3. off, disable the time jitter algorithm, like atc.# apply for all dvr plan.# default: fulltime_jitter full;# on_dvr, never config in here, should config in http_hooks.# for the dvr http callback, @see http_hooks.on_dvr of vhost hooks.callback.srs.com# @read https://github.com/ossrs/srs/wiki/v4_CN_DVR#http-callback# @read https://github.com/ossrs/srs/wiki/v4_CN_DVR#http-callback}
}
DVR的计划即决定什么时候关闭flv文件,打开新的flv文件,主要的录制计划包括:
- session:按照session来关闭flv文件,即编码器停止推流时关闭flv,整个session录制为一个flv。
- segment:按照时间分段录制,flv文件时长配置为dvr_duration和dvr_wait_keyframe。注意:若不按关键帧切flv(即dvr_wait_keyframe配置为off),所以会导致后面的flv启动时会花屏。
- time_jitter: 时间戳抖动算法。full使用完全的时间戳矫正;zero只是保证从0开始;off不矫正时间戳。
- dvr_path: 录制的路径
示例
vhost __defaultVhost__ {rtc {enabled on;bframe discard;}dvr {enabled on;dvr_path /home/srs/[app]/[stream]/[2006]/[01]/[02]/[15].[04].[05].[999].flv;dvr_plan segment;dvr_duration 600;dvr_wait_keyframe on;}http_remux {enabled on;mount [vhost]/[app]/[stream].flv;}
}
我这里设置的是10分钟记录一次
记录效果如下所示(tmp是临时文件)
保存成功后的文件为flv格式视频
总结
- SRS配置DVR后默认会对所有的视频流进行记录(后面看看能不能指定流进行记录)
- 如果文件存储的太多,可以设置一个定时清理的方法(只保留一个月的视频)
SRS学习-配置DVR相关推荐
- SRS学习-部署SRS(GB28181版)
SRS学习-部署SRS(GB28181版) 介绍 SRS是一个简单高效的实时视频服务器,支持RTMP/WebRTC/HLS/HTTP-FLV/SRT/GB28181. SRS官网 单点版架构图如下所示 ...
- 深度学习配置环境全攻略
深度学习配置环境全攻略 1. 安装python2.7 外网链接教程 安装所有必需的依赖项 sudo apt-get update sudo apt-get install build-essentia ...
- (三)MkDocs学习——配置主题
mkdocs学习笔记系列 (一)MkDocs 学习--快速开始 (二)MkDocs学习笔记--撰写文档 (三)MkDocs学习--配置主题 (四)MkDocs学习--自定义主题 (五)MkDocs学习 ...
- SRS学习-HTML加载FLV视频
SRS学习-HTML加载FLV视频 介绍 FLV是FLASHVIDEO的简称,FLV流媒体格式是一种新的视频格式,全称为FlashVideo.由于它形成的文件极小.加载速度极快,使得网络观看视频文件成 ...
- 01 动手学习深度学习-配置环境pytorch
01 动手学习深度学习-配置环境pytorch 一.需要的配置以及准备 二.安装anaconda 二.安装CUDA: 三.安装CUDNN 四.安装pytorch 五.安装jupyter noteboo ...
- srs流媒体录制视频-配置dvr
硬盘录像机(Digital Video Recorder,简称DVR),即数字视频录像机,相对于传统的模拟视频录像机,采用硬盘录像,故常常被称为硬盘录像机,也被称为DVR. 它是一套进行图像存储处理的 ...
- IBatisNet1.5学习--配置篇
最近准备学习IbatisNet1.5,顺便将学习的过程记录下来,整个过程的环境是VS2005+IBatisNet1.5,下面首先我们来看一下IBatisNet的配置. IBatisNe ...
- Ubuntu16.04 安装配置深度学习配置:GPU加速 Cuda+cudnn+opencv+caffe
目录 一. 电脑配置: 二. 安装过程 1.安装相关依赖项 2.安装NVIDIA驱动 一,下载安装驱动法 二.终端直接下载安装驱动法. 3.安装CUDA 4.配置cuDNN 5.安装opencv3.1 ...
- postgresql学习配置主从同步和自动备份
最近刚接手一个维护项目,一个生产环境出了故障,所有数据都损毁了.数据第一啊,原先在做方案的时候厂家已经建议客户做冗余什么的,但是始终因为资金的原因没有落实,但也得想办法提高数据安全性开拔,优先保存数据 ...
- 国标GB28181 SRS安装配置
部署环境:Liunx 安装: //目前安装5.0.26版本 在git上我切换不到gb28181分支 推荐国内gitcode好用! //下载安装 git clone https://gitcode.ne ...
最新文章
- FDA转向AI加快药物研发和审批速度
- 大数据挑战赛(大佬篇)
- 当你和你女朋友闹矛盾时......
- js中的字符长度问题
- Linux 基础知识(2)---Linux内核空间内存申请函数kmalloc、kzalloc、vmalloc的区别
- java绘制一个饼图_一个简单的绘制饼图的 Java Bean 实例
- nyoj 4 ASCII码排序(set,multiset)
- 算法导论7:选择算法和数据结构准备 2016.1.7
- python参考手册 第二章
- 通达信l2接口公式代码怎么获取excel数据?
- PCAN监测can总线状态设置
- 这些年java全栈开发涉及到工具
- please insert the disc labeled ‘Ubuntu 18.04.5 LTS _Bionic Beaver_ - Release amd64 (20200806.1)‘ in
- 软件测试设计——按类型划分
- Spring boot Whitelabel Error Page解决方法(弱鸡方法,非全部适用)
- qiankun 传统项目配置_前端微服务
- SQL注入、XSS、XXE、CSRF、SSRF、越权漏洞、文件上传、文件包含总结篇
- 训练自己的点云数据进行3D目标检测
- ABB AC500 PLC 与西门子 S7-300 CPU DP 通讯
- 腾讯云部署homeassistant踩坑记录