Skip to content

Commit

Permalink
swap width and height for videos with rotate 90 (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
amietn committed Mar 17, 2019
1 parent 135dbfb commit 3254221
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions vcsi/vcsi.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,17 @@ def compute_display_resolution(self):
"""
self.sample_width = int(self.video_stream["width"])
self.sample_height = int(self.video_stream["height"])

# videos recorded with a smartphone may have a "rotate" flag
try:
rotation = int(self.video_stream["tags"]["rotate"])
except KeyError:
rotation = None

if rotation == 90:
# swap width and height
self.sample_width, self.sample_height = self.sample_height, self.sample_width

sample_aspect_ratio = "1:1"
try:
sample_aspect_ratio = self.video_stream["sample_aspect_ratio"]
Expand Down

0 comments on commit 3254221

Please sign in to comment.