-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Script for Hikvision cameras with SD card #11
Comments
Since I do not have a hikvision camera, can you please add the line |
python3 downloadTodayRecordings.py |
I may have found the cause of this error, can you verify if 51ebdd8 fixed this issue? Also, in master I specified how to enable DEBUG mode by uncommenting this line HikLoad/downloadTodayRecordings.py Line 13 in 01c23b6
If there are any more issues, this one should help a lot for debugging. |
max@MacBook-Pro HikLoad-master % python3 downloadTodayRecordings.py |
This is definitely related to kkroening/ffmpeg-python#174 (comment), I will add in README how to install dependencies using virtualenv so this shouldn't happen again. |
uninstall both with:
|
some issues
|
my cameras are installed at a remote site with 30-40ms latenсy lte channel with 5 mbps upstream speed, but camera records with 8 mbps vbr. may be this is a problem? |
|
it's works! thanks! |
it's possible to generate .mp4 or .mov video container instead of .mkv? |
For the timezone problem, I usually get what the camera says, so maybe check if the camera is set in UTC time or not. If it is set in your local time and returns UTC time, then you should be able to change the string to reflect your real timezone. And for the HikLoad/downloadTodayRecordings.py Lines 49 to 50 in 7a4e016
|
i try to change file to .mov or .mp4 QT player says 'The file isn’t compatible with QuickTime Player. |
I think I fixed both of the problems, the first one was because I was just copying the video from the camera without transcoding, the second one was because I kinda forgot how timezones work. |
python3 downloadTodayRecordings.py |
To be honest, if fc19ee7 dosen't fix this issue I might revert the whole timezone part and keep all of the times in UTC. |
ok. what about .mp4 container instead of .mkv? it's ffmpeg call option as i know it. |
maybe you can modify the script to accept timespan interval parameters and generate folder with camera name for example? |
I think I made almost everything that you asked, you can now run the script using arguments. To replicate the behaviour that you wanted run |
===== |
I guess you can specify the |
If you add the option |
answer is: Found 0 recordings for channel CAM 2 |
INFO:root:Found channels ['101'] |
This error is just weird, the camera says it found something but dosen't want to return anything. For now I implemented the ISAPI spec a bit weirdly, since somehow with optional fields it works for you. I also added a way to return more than 64(for my DVR) results, by following what the DVR says. |
Since now it works, I finally added |
strange bugs.. I know for a fact that I have one record in my camera between 6 and 7 a.m. (06:52:01 exact time) if i run script without time span args: if i run with time span args: INFO:root:Found channels ['101'] |
oops, now i will try latest version )) |
same issue with latest ver INFO:root:Found channels ['101'] |
--localtimefilenames >> INFO:root:Found 16 recordings for channel 101 file name 20210920005201.mkv for file from 06:52:01 instead of 20210920065201.mkv |
python3 download.py 111.111.111.111 admin pass --folders --localtimefilenames --videoformat mp4 --days 2INFO:root:Found channels ['101'] |
Yeah, this one was because I substracted the time difference instead of adding. Also added a little check in case hikvision returns a string instead of an object... |
what about this? |
fixed |
today i have only one record from 06 to 07 am. 06:52:01 exact time --folders --localtimefilenames --videoformat mp4 --days 1 |
next step of usability - stack files in a folders by date ) |
and --yesterday arg ) |
Ok, added this
Reimplemented --folders to specify how exactly you want the folders to be created(onepercamera, oneperday, onepermonth, oneperyear)
For this one I made so that the code dosen't stop when it sees that error, I don't really know what could cause this except the server returning wrong XML data. |
Also if the new code dosen't download videos correctly, you can try the |
good idea, may be the best way is download via http then convert with ffmpeg? so slow but more reliably |
If there is specified another file extension than "mkv"(since the dvr saves the videos in this format), it will be transcoded using ffmpeg. |
yes, but how to automate this transcoding locally ) |
Isn't the script automatically transcoding already? It is supposed to do that, but maybe I introduced a bug that won't let it work. |
automate transcoding works only via rtsp download, with --ffmpeg option. |
Can you try running the latest version? If the bug still exists, can you specify what arguments are you using? For me, it works using the arguments
|
max@MacBook-Pro HikLoad-master % python3 download.py 111.111.111.111 admin pass --folders oneperday --localtimefilenames --debug [hikvisionapi.utils - getXMLRaw() ] http://admin:[email protected]/ISAPI/Streaming/channels |
here is answer for request url /ISAPI/Streaming/channels ( <> changed with [])[StreamingChannelList xmlns="http://www.hikvision.com/ver20/XMLSchema" version="2.0"] |
here is for ISAPI/ContentMgmt/search/profile |
I am starting to question the validity of the ISAPI specification... Also removed the line that caused this error. |
what about http download then transcode? not on-the-fly. imho rtsp download with on-the-fly transcoding is not best way. |
That can already be accomplished by running |
I am closing this issue since everything should be solved. If there are any more problems, be sure to create another issue or reply to this one. |
It is possible to modify this script for use with cameras, not DVRs?
trying to load from DS-2CD2143G0-I
Traceback (most recent call last):
File "/Users/max/Downloads/HikLoad-master/downloadTodayRecordings.py", line 22, in
for channel in channelList['StreamingChannelList']['StreamingChannel']:
KeyError: 'StreamingChannelList'
The text was updated successfully, but these errors were encountered: