跳转到内容
View in the app

A better way to browse. Learn more.

彼岸论坛

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
欢迎抵达彼岸 彼岸花开 此处谁在 -彼岸论坛

[程序员] 关于一个摄像头的需求,求大佬指点

发表于

现在有这样一个需求,需要开发一个程序,写一个接口,当接口接收到请求,就需要获取摄像头当前时间-5 到+5 秒的视频

举例说明: 比如在 10:00:00 接口接收到请求,那就需要将摄像头 9:59:55~10:00:05 这 10 秒的视频保存到指定目录并推送至指定地方,并且需要在 30 秒内完成该逻辑

设备是海康威视摄像头

我尝试过的方法

1 、通过海康的 RTSP 流添加 starttime 和 endtime 来获取回放流,比如我 10:00:00 收到请求,我就拼接 rtsp 流地址 rtsp://admin:xxx@192.168.1.33:554/Streaming/101?starttime=20240712T095955Z,然后使用 ffmpeg 进行录制 10 秒,就能刚刚好保存出这个时间段的视频

发现的问题: 不知道是什么原因,我只要获取当前时间的 rtsp 流,就无法访问,经过写代码尝试,发现必须获取当前时间 2 分钟前的流,才可以访问,比如 10:00:00 接到请求,只能访问到 9:58:00 左右的回放流,我猜测是因为录像没有实时落盘的原因?

2 、集成海康 SDK 尝试,也遇到了跟 1 操作一样的问题,就是没办法实时或者说获取 10 秒内的回放,获取 1 分钟之前的回放文件可以成功,比 rtsp 稍微好一点,但是也不能满足我的需求,我在看海康文档的时候,有个刷新索引的接口,写的是设备默认 2 分钟刷新,但是我尝试了,我的摄像头提示不支持该接口

我通过官方的 App 海康互联测试,他们 App 的回放功能好像就没这么大的差距,他们的 App 能回放 30 秒内的视频

希望求大佬指点,或者有没有其他办法能实现这个需求,万分感谢

Featured Replies

No posts to show

创建帐户或登录来提出意见

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.