diff --git a/files/helpers/media.py b/files/helpers/media.py index bdd577021..0395cfcca 100644 --- a/files/helpers/media.py +++ b/files/helpers/media.py @@ -170,6 +170,7 @@ def process_video(file, v): try: video_info = ffmpeg.probe(old)['streams'] + codec = None for stream in video_info: if stream["codec_type"] == "video": codec = stream['codec_name'] @@ -179,6 +180,10 @@ def process_video(file, v): 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.") + if not codec: + 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.") + is_reencoding = False if codec != 'h264': copyfile(old, new)