667bdrm / sofiactl

sofiactl is an open source cross-platform tool and sdk to control Sofia powered Hi35xx DVR devices
80 stars 22 forks source link

run command OPFileQuery not return any data [Please help] #14

Open kienkeane99 opened 3 years ago

kienkeane99 commented 3 years ago

Hi,

I'm newbie with Perl, I downloaded your project and try to run in cmd (win 10) , it works well for some commands. => good try

Now i want to search file with command OPFileQuery

I used WireShark to find this log from my camera : { "Name" : "OPFileQuery", "OPFileQuery" : { "BeginTime" : "2021-08-17 00:00:00", "Channel" : 0, "DriverTypeMask" : "0x0000FFFF", "EndTime" : "2021-08-17 23:59:59", "Event" : "*", "StreamType" : "0x00000000", "Type" : "h264" }, "SessionID" : "0x57" }

Then i used this command following your git: sofiactl.pl --user "admin" --pass "correct_password" --host "correct_host" --port 34567 --command "OPFileQuery" --bt "2021-08-17 00:00:00" --et "2021-08-19 23:59:59" --ch 0 --d

I enter correct paramters , but it not return any data, this is the log:

image

Could you please help to advise.

Thanks.

kienkeane99 commented 3 years ago

Hi,

I can find the record video by command OPFileQuery now, it returns json data like :

{ "BeginTime":"2021-08-17 00:00:00", "DiskNo":0, "EndTime":"2021-08-17 01:00:00", "FileLength":"0x000B656D", "FileName":"/idea0/2021-08-17/001/00.00.00-01.00.00[H][@2905d][3].h264", "SerialNo":0 }

Now i want to view this record via VLC, so my question is : +) follow this FileName, how can i get stream url without downloading the video. +) if not anyway else ?

Thanks,

667bdrm commented 3 years ago

I didn't implemented streaming since these devices has working streaming at 554 port. If you strictly need this you can implement streaming from original protocol, see MONITOR* and PLAY* opcodes. The implementation should be similar as for download, but you need to convert the received frames to your stream format.

Here is RTSP urls compatible with vlc, ffmpeg, etc:

high quality: rtsp://[ip address]:554/?user=admin&password=[password]&channel=0&stream=0.sdp

low quality: rtsp://[ip address]:554/?user=admin&password=[password]&channel=0&stream=1.sdp

madmanxxx commented 2 years ago

IMHO this issue needs clarification. Please correct me if I misunderstand anything.

What is the intention of the issue author?

I think @kienkeane99 would like to achieve a seamless playback, much like the ActiveX allows - rewind, jump to arbitrary time, advance one frame etc. using VLC. Unfortunately - as far as I understand the code and its current state - this is impossible directly. Read on.

How are DVR recordings currently accessible?

sofiactl supports (currently undocumented) Download command. It downloads raw h264 stream to a file named exactly as it is visible by querying with OPFileQuery. As with ActiveX, it is terribly slow and does not allow random access to stream.

How to access recordings non-linearly? (just a guess)

OPPlayback supports StartTime and EndTime parameters, so it is theoretically possible to code sofiactl in a way where there could be one instance constantly downloading data (and passing it to VLC via stdout?), while the other could send commands what chunk (start time, end time) to send.

PS: Not sure what OPMonitor does, but I'm guessing it just streams live stream - an equivalent of RTSP - and is irrelevant.