Skip to content

Commit

Permalink
Odd video height
Browse files Browse the repository at this point in the history
  • Loading branch information
Cuchulain committed Dec 14, 2023
1 parent d6df5ea commit ab09909
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions recode_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,15 @@ def get_ffmpeg_parameters(file_path, params):
if height > params['dimensions']['max']['height']:
resize_video = True
new_height = params['dimensions']['max']['height']
new_width = int(width * (new_height / height))
new_width = int(width * new_height / height)

if width > params['dimensions']['max']['width']:
resize_video = True
new_width = params['dimensions']['max']['width']
new_height = int(height * (new_width / width))
new_height = int(height * new_width / width)
if new_height % 2 == 1:
new_width = int(new_width * (new_height + 1) / new_height)
new_height += 1

recode_video = resize_video

Expand Down

0 comments on commit ab09909

Please sign in to comment.