From 59f293f678af950a21a6fabdd6739637facc9119 Mon Sep 17 00:00:00 2001 From: Aevann Date: Sat, 26 Oct 2024 17:39:57 +0300 Subject: [PATCH] limit input threads --- files/helpers/media.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/files/helpers/media.py b/files/helpers/media.py index 7d452437f..5dc78f54a 100644 --- a/files/helpers/media.py +++ b/files/helpers/media.py @@ -109,7 +109,7 @@ def process_audio(file, v, old=None): new = old + extension try: - ffmpeg.input(old).output(new, loglevel="quiet", map_metadata=-1, threads=1).run() + ffmpeg.input(old, threads=1).output(new, loglevel="quiet", map_metadata=-1, threads=1).run() except: os.remove(old) if os.path.isfile(new): @@ -132,7 +132,7 @@ def process_audio(file, v, old=None): def reencode_video(old, new, check_sizes=False): tmp = new.replace('.mp4', '-t.mp4') try: - ffmpeg.input(old).output(tmp, loglevel="quiet", map_metadata=-1, threads=1).run() + ffmpeg.input(old, threads=1).output(tmp, loglevel="quiet", map_metadata=-1, threads=1).run() except: os.remove(old) if os.path.isfile(tmp): @@ -206,7 +206,7 @@ def process_video(file, v, post=None): gevent.spawn(reencode_video, old, new, True) else: try: - ffmpeg.input(old).output(new, loglevel="quiet", map_metadata=-1, acodec="copy", vcodec="copy", threads=1).run() + ffmpeg.input(old, threads=1).output(new, loglevel="quiet", map_metadata=-1, acodec="copy", vcodec="copy", threads=1).run() except: os.remove(old) if os.path.isfile(new): @@ -232,7 +232,7 @@ def process_video(file, v, post=None): url = SITE_FULL_VIDEOS + new.split('/videos')[1] name = f'/images/{time.time()}'.replace('.','') + '.webp' - ffmpeg.input(new).output(name, loglevel="quiet", map_metadata=-1, threads=1, **{"vf":"scale='iw':-2", 'frames:v':1}).run() + ffmpeg.input(new, threads=1).output(name, loglevel="quiet", map_metadata=-1, threads=1, **{"vf":"scale='iw':-2", 'frames:v':1}).run() posterurl = SITE_FULL_IMAGES + name media.posterurl = posterurl