Attempt to reduce leak of ffmpeg previews

This commit is contained in:
Leo Vasanko 2023-11-21 12:23:24 +00:00
parent 02c5e484b5
commit 8437c1f60e

View File

@ -1,4 +1,5 @@
import asyncio import asyncio
import gc
import io import io
import mimetypes import mimetypes
import urllib.parse import urllib.parse
@ -109,5 +110,7 @@ def process_video(path, *, maxsize, quality):
img = img.rotate(rot, expand=True) img = img.rotate(rot, expand=True)
img.save(imgdata, format="webp", quality=quality, method=4) img.save(imgdata, format="webp", quality=quality, method=4)
del img del img
ret = imgdata.getvalue()
return imgdata.getvalue() del imgdata
gc.collect()
return ret