GitHub:https://github.com/ZLMediaKit/ZLMediaKit
https://gitee.com/xia-chu/ZLMediaKit
使用vs2017在win10平台进行编译。摄像头使用大华网络摄像头。
实际使用使用MediaServer支持的HTTP API,使用postman进行测试。
拉流功能:
http://127.0.0.1/index/api/addStreamProxy
关闭拉流功能:
http://127.0.0.1/index/api/delStreamProxy
截图功能:
http://127.0.0.1/index/api/getSnap
该功能需要在拉流后才能进行。最终会在ZLMediaKit\release\windows64\Debug\www\snap\3260a9493c6d83f8fa3c16c05a08f412
目录下生成截图的图片。
PYTHON测试,返回结果为bytes类型,然后存为本地文件,证明结果正确。
import requests
url = "http://127.0.0.1/index/api/getSnap"
json_values={"url":"rtsp://admin:[email protected]","secret":"035c73f7-bb6b-4889-a715-d9eb2d1925cc", "timeout_sec":10, "expire_sec":1}
response = requests.post(url, data=json_values)
print(response.content)
with open("1.jpg",'wb') as f:
f.write(response.content)
录制视频功能:
http://127.0.0.1/index/api/startRecord
停止录制视频功能:
http://127.0.0.1/index/api/stopRecord
最终会在ZLMediaKit\release\windows64\Debug\www\record\rtsp\7L0DFCEPAGD37F7\2022-07-13
目录下生成录制的MP4视频。