Skip to content
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

Downloaded video is incomplete if download is started shortly after recording ends #37

Open
theonlydvr opened this issue Nov 29, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@theonlydvr
Copy link

Describe the bug
I use the ISAPI/hikload to coordinate video recording and downloading for my research. However, when I download a video immediately after I stop a recording using ISAPI, the video is sometimes incomplete. However, the video is correctly formatted if I look on the DVR itself.

To Reproduce
To start a recording:
hikutils.putXML(self.server, 'ContentMgmt/record/control/manual/start/tracks/' + cam)

To stop a recording:
hikutils.putXML(self.server, 'ContentMgmt/record/control/manual/stop/tracks/' + addr)

To download:

resp = self.server.ContentMgmt.search.getAllRecordingsForID(addr)
vids = resp['CMSearchResult']['matchList']['searchMatchItem']
if not isinstance(vids, list):
  vids = [vids]
vid = vids[-1]
dwnld = self.server.ContentMgmt.search.downloadURI(vid['mediaSegmentDescriptor']['playbackURI'])
if not os.path.exists(output_folder):
  os.makedirs(output_folder)
with open(output_folder + str(name) + "_" + addr + ".mp4", 'wb') as file:
  file.write(dwnld.content)

Additional context
Device is an iDS-7216HQHI-M2/S

@theonlydvr theonlydvr added the bug Something isn't working label Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant