Onvif playback stream cannot seek

扶醉桌前 提交于 2021-01-28 14:14:00

问题


I'm trying to obtain playback video streams from some Axis and Hikvision cameras, using Onvif. I'm doing this in a C# application, and the resulted stream is played in VLC.

Using the FindRecordings/GetRecordingSearchResult calls and then GetReplayUri I can obtain the playback stream (RTSP/H264), but here I have this problem: this behaves like a live stream - I can only use play and pause. I cannot use the time cursor to seek, cannot play in reverse.

So I find this unusable for a playback application - you have to watch the entire recording (days or hours of recording!) in order to see a specific event in time. And once you play it, you cannot go back 1 minute to see it again.

This seems quite stupid to me, so I believe that I'm doing something wrong in my code. Maybe I'm missing some configuration in order to obtain a 'true' playback stream.

My question is: is this playback stream behavior the 'standard' one, and I cannot expect more on this? Or some of you have this working ok (seek, reverse, frame by frame stepping), so I will know it can be done.

Thank you.


回答1:


Reverse playback is possible, but it is not easy. First, the reverse replay is initiated using the Scale header field with a negative value. As an example:

PLAY rtsp://192.168.0.1/path/to/recording RTSP/1.0 
Cseq: 123 
Session: 12345678
Require: onvif-replay 
Range: clock=20090615T114900.440Z-
Rate-Control: no 
Scale: -1.0

After the stream is initialized, you will get GOPs in reverse order, not just reversed frames. I don't know if VLC supports this way of operating.

Be aware that only devices with the ReversePlayback capability support reverse playback.

Please refer to the streaming specification for further details.




回答2:


This is not a real solution to the problem above, but maybe it would help others to deal with this situation.

Some cameras with which I worked were continuously recording on the same video file (so the time range was not known) and they were reporting (via RTSP) the available time interval like this:

range:npt=0-

Due to this, VLC was not displaying any time interval in the time slider, so it was not allowing for seek. In my case, it was a requirement to use VLC, so I had to find a workaround to the problem. This was a module which was acting like a proxy, and it sit between VLC and the RTSP source (camera). So all RTSP traffic between VLC and camera was going via this module which I controlled, so I could easily change the responses from camera in a way which was ok for VLC, so I got the seek capability available in VLC.



来源:https://stackoverflow.com/questions/49025449/onvif-playback-stream-cannot-seek

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!