limit input threads

master
Aevann 2024-10-26 17:39:57 +03:00
parent 70802d3b58
commit 59f293f678
1 changed files with 4 additions and 4 deletions

View File

@ -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