Skip to content

Commit

Permalink
[ie/tiktok] Fix web format resolution calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
kclauhk committed Aug 9, 2024
1 parent 539c0b1 commit aa8ab2a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions yt_dlp/extractor/tiktok.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,13 +505,13 @@ def _extract_web_formats(self, aweme_detail):
if dimension == 540: # '540p' is actually 576p
dimension = 576
if ratio < 1: # portrait: res/dimension is width
y = int(dimension / ratio)
y = round(dimension / ratio)
format_info.update({
'width': dimension,
'height': y - (y % 2),
})
else: # landscape: res/dimension is height
x = int(dimension * ratio)
x = round(dimension * ratio)
format_info.update({
'width': x + (x % 2),
'height': dimension,
Expand Down

0 comments on commit aa8ab2a

Please sign in to comment.