Dahua API "Download media file between times"

Joined
Nov 28, 2017
Messages
26
Reaction score
6
Location
London
I was happy to discover the "Download media file between times" API call, ie.
http://<server>/cgi-bin/loadfile.cgi?action=startLoad&channel=<ChannelNo>&startTime=<starttime> &endTime=<endtime>[&subtype=<typeNo>]

I was even happier that it seemed to work almost immediately with minimal hassle, delivering an "octet stream", as the documention says it does.

However I haven't been able to identify the video format of the octet stream. ffmpeg doesn't seem able recognise it without some hints, and I have no idea what hints to give it.

Any and all suggestions welcome!
 
Joined
Nov 28, 2017
Messages
26
Reaction score
6
Location
London
Aha; good idea. I just tried that, without success so far. It failed at HTTP auth, without ever getting an octet stream.

My VLC installation doesn't seem to complete the HTTP Digest auth. It appears to send the initial request, receives a 401 response with the "WWW-Authenticate: Digest realm=..." header, logs the response but otherwise ignores it. Eventually the camera gives up and sends a 500.

I'm going to try serving the saved octet stream from an http server with no auth. We shall see.

On a related issue.... all my devices are on private nets, only accessible through OpenVPN. I've wasted many hours in the past trying to persuade Dahua cams to do Basic or no auth, without success. Has anybody succeeded in doing this? Am I missing something?

Cheers
Sean
 
Joined
Nov 28, 2017
Messages
26
Reaction score
6
Location
London
Progress!
I can't persuade my VLC (3.0.6 Vetinari) to decode a file that just contains the octet stream from the camera.

However, my initial ffmpeg tests used "ffmpeg version 2.8.15-0ubuntu0.16.04.1". I tried downloading the current ffmpeg snapshot ("ffmpeg version N-93913-g1a74b04737-tessus"); major improvement. This version will happily convert the saved octet streams.

Even better, it still works without format conversion, ie. using " -vcodec copy", which means it is almost instantaneous. I guess ffmpeg is just putting the H.264 stream in an mpeg container (or something)

Next step will be to pipe the Camera's octet stream directly to ffmpeg.

I don't know if this is interesting to others here, so I'll stop posting updates unless anybody encourages me to continue :)

Cheers
Sean
 
Top