Skip to content

Commit

Permalink
Handle edge case with display width hints.
Browse files Browse the repository at this point in the history
  • Loading branch information
clolsonus committed Jan 2, 2021
1 parent 7452292 commit 0e91c72
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/video_track.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ def open(self, file):
width_mul = int(num) / int(den)
else:
width_mul = 1
self.displayw = int(round(self.w * width_mul))
self.w = self.displayw
if width_mul < 0.8 or width_mul > 1.2:
self.displayw = int(round(self.w * width_mul))
self.w = self.displayw
if '@duration' in metadata['video']:
self.duration = float(metadata['video']['@duration'])
else:
Expand Down Expand Up @@ -98,8 +99,8 @@ def get_frame(self, local_time, rotate=0):
#else:
except:
self.frame = None

if self.frame is not None:
#cv2.imshow("before", self.frame)
if rotate == 0:
self.raw_frame = self.frame
elif rotate == 90:
Expand All @@ -112,6 +113,7 @@ def get_frame(self, local_time, rotate=0):
self.raw_frame = cv2.flip(tmp, 0)
else:
print("unhandled rotation angle:", rotate)
#cv2.imshow("after", self.raw_frame)
else:
# no more frames, impliment a simple fade out
if self.raw_frame is not None:
Expand Down

0 comments on commit 0e91c72

Please sign in to comment.