提交 0f644f77 authored 作者: zw.wang's avatar zw.wang

feat: 录制

上级 4410da43
......@@ -9,6 +9,7 @@ services:
- 5001:5001
volumes:
- /data/videos/isc-record:/data/videos/isc-record
- /var/log/event_rcv:/var/log/event_rcv
influxdb:
container_name: influxdb
image: ilabservice-registry.cn-hangzhou.cr.aliyuncs.com/basic/influxdb:monitor
......
......@@ -127,7 +127,7 @@ class HikVisionClient(object):
'endTime': end_time,
'recordLocation': 1,
'protocol': protocol,
'expand': 'transcode=1&systemformat={}&fileSize=1024'.format(streamform),
'expand': 'fileSize=1024',
'streamform': streamform
}
print('回放取流请求参数:', body)
......
......@@ -52,10 +52,10 @@ def recorder(camera_index, start_time, end_time):
if file_duration < complete_duration - 2:
# 视频文件时长小于完整时长
new_start_time = start_time + timedelta(seconds=file_duration)
part_file_name = 'rtmp_{}_{}_{}.mp4'.format(
part_file_name = os.path.join(video_path, 'rtmp_{}_{}_{}.mp4'.format(
start_time.strftime('%Y%m%dT%H%M%S'),
new_start_time.strftime('%Y%m%dT%H%M%S'), part_num
)
))
shutil.move(file_info['file_name'], part_file_name)
part_files_set.add(part_file_name)
......@@ -82,6 +82,6 @@ def stream_record(stream, start_time, end_time):
stream_url = '{}?beginTime={}&endTime={}&{}'.format(stream['url'],
start_time,
end_time, stream['extra_args'])
file_name = 'rtmp_{}_{}.mp4'.format(start_time, end_time)
file_name = os.path.join(video_path, 'rtmp_{}_{}.mp4'.format(start_time, end_time))
record_thread(stream_url, file_name)
return get_video_duration(file_name)
......@@ -20,8 +20,9 @@ client = HikVisionClient(config.get('KEY'), config.get('SECRET'),
def main():
start_time = datetime(2021, 4, 25, 15, 19)
end_time = datetime(2021, 4, 25, 15, 22, 20)
# rtmp_20210426T003128_20210426T003247.mp4
start_time = datetime(2021, 4, 26, 8, 31, 28)
end_time = datetime(2021, 4, 26, 8, 32, 47)
recorder('f8a3c4d9b8ae42118b4db9fcf7895031', start_time, end_time)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论