博客
关于我
python cv2读取rtsp实时码流按时生成连续视频文件
阅读量:804 次
发布时间:2023-03-05

本文共 488 字,大约阅读时间需要 1 分钟。

代码实现

# coding: utf-8  import datetime  import cv2  import os  ip = '192.168.3.160'.replace(".", "_") rtsp = 'rtsp://admin:admin@192.168.3.160:554/1/1' 初始化摄像头 cap = cv2.VideoCapture(rtsp) fourcc = cv2.VideoWriter_fourcc(*'XVID') size = (int(cap.width), int(cap.height)) 设置视频编码格式 videoWriter = cv2.VideoWriter('output.mp4', fourcc, 20, size) 开始视频捕获 while cap.isOpened(): ret, frame = cap.read() if not ret: break # 保存视频帧  videoWriter.write(frame)  停止视频捕获 cap.release() videoWriter.release()

转载地址:http://ktafk.baihongyu.com/

你可能感兴趣的文章
python | isort,一个有趣的 自动整理导入语句 的Python 库!
查看>>
python | jinja,一个超酷的 Python 库!
查看>>
python | joblib,一个强大的 Python 库!
查看>>
python调用git bash_Python学习第70课-用Git Bash在命令行打开sublime
查看>>
python | jsonschema,一个实用的 验证 JSON 数据结构 Python 库!
查看>>
python课程的中期报告范文_课题研究中期总结报告范文
查看>>
python | lxml,一个超酷的 关于XML/HTML 文档 Python 库!
查看>>
python | mplfinance,一个有趣的金融数据可视化 Python 库!
查看>>
python | nipy,一个强大的关于 神经影像数据分析 的Python 库!
查看>>
python | NLTK,一个强大的 自然语言处理 Python 库!
查看>>
python | nupic,一个强大的 处理时间序列的Python 库!
查看>>
python | orange3,一个神奇的 Python 库!
查看>>
python | pdfminer,一个神奇的 关于PDF 文件的 Python 库!
查看>>
python | pendulum,一个有趣的 日期和时间 Python 库!
查看>>
python | pluginbase,一个神奇的 关于插件框架 的Python 库!
查看>>
python | ply,一个无敌的 词法和语法分析工具 的Python 库!
查看>>
python | py2exe,一个超酷的 Python 库!
查看>>
python | pyautogui,一个超酷的 Python 库!
查看>>
python | pybaobabdt,一个超强的 决策树可视化 Python 库!
查看>>
python | pycco,一个神奇的 Python 库!
查看>>