Skip to content

Commit

Permalink
when creating anchors, use alarm/snapshot image instead of fid as the…
Browse files Browse the repository at this point in the history
…y are often incorrect during video extraction
  • Loading branch information
pliablepixels committed Apr 27, 2020
1 parent 821b675 commit 4f1440c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions hook/zmes_hook_helpers/image_manip.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,14 @@ def createAnimation(frametype, eid,fname, types):
end_frame = int(min(totframes, fid + (buffer_seconds*fps)))
skip =round(fps/target_fps)

g.logger.debug (f'animation: anchor={fid} start={start_frame} end={end_frame} skip={skip}')
g.logger.debug (f'animation: anchor={frametype} start={start_frame} end={end_frame} skip={skip}')
g.logger.debug('animation: Grabbing frames...')
images = []
od_images = []

od_url= '{}/index.php?view=image&eid={}&fid={}&username={}&password={}&width={}'.format(g.config['portal'],eid,fid,g.config['user'],urllib.parse.quote(g.config['password'], safe=''),g.config['animation_width'])
g.logger.debug (f'Grabbing anchor frame: {fid}...')
# use frametype (alarm/snapshot) to get od anchor, because fid can be wrong when translating from videos
od_url= '{}/index.php?view=image&eid={}&fid={}&username={}&password={}&width={}'.format(g.config['portal'],eid,frametype,g.config['user'],urllib.parse.quote(g.config['password'], safe=''),g.config['animation_width'])
g.logger.debug (f'Grabbing anchor frame: {frametype}...')
try:
od_frame = imageio.imread(od_url)
# 1 second @ 2fps
Expand Down

0 comments on commit 4f1440c

Please sign in to comment.