Skip to content

Commit

Permalink
um
Browse files Browse the repository at this point in the history
  • Loading branch information
xAmarnath committed May 5, 2024
1 parent c164613 commit dd5c0d6
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions modules/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,13 +266,14 @@ def get_file_type(file):

def generate_thumbnail(in_filename, out_filename):
"""gen thumb for video"""
probe = ffmpeg.probe(in_filename)
time = 2
try:
width = probe["streams"][0]["width"]
except:
width = 720

try:
probe = ffmpeg.probe(in_filename)
time = 2
try:
width = probe["streams"][0]["width"]
except:
width = 720
(
ffmpeg.input(in_filename, ss=time)
.filter("scale", width, -1)
Expand All @@ -294,5 +295,5 @@ def get_video_metadata(file):
data.get("streams", [])[0].get("width", 1),
data.get("streams", [])[0].get("height", 0),
)
except (KeyError, IndexError):
except (KeyError, IndexError, ffmpeg.Error, Exception):
return (1, 1280, 720)

0 comments on commit dd5c0d6

Please sign in to comment.