From c7841d437ad303dff1b58276c33123bc85d31d0e Mon Sep 17 00:00:00 2001 From: Aevann Date: Sat, 6 Apr 2024 14:02:41 +0200 Subject: [PATCH] fix this https://watchpeopledie.tv/h/meta/post/61549/megathread-for-bugs-and-suggestions/3093990#context --- files/helpers/media.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/files/helpers/media.py b/files/helpers/media.py index ec6c1bcc6..282c23015 100644 --- a/files/helpers/media.py +++ b/files/helpers/media.py @@ -168,9 +168,12 @@ def process_video(file, v): new = f'{old}.mp4' try: - video_info = ffmpeg.probe(old)['streams'][0] - codec = video_info['codec_name'] - bitrate = int(video_info.get('bit_rate', 3000000)) + video_info = ffmpeg.probe(old)['streams'] + for stream in video_info: + if stream["codec_type"] == "video": + codec = stream['codec_name'] + bitrate = int(stream.get('bit_rate', 3000000)) + break except: os.remove(old) abort(400, "Something went wrong processing your video on our end. Please try uploading it to https://pomf2.lain.la and post the link instead.")