Attempt to reduce leak of ffmpeg previews
This commit is contained in:
parent
c3d6aecffd
commit
27422ae1e2
|
@ -108,11 +108,13 @@ def process_video(path, *, maxsize, quality):
|
||||||
img = frame.to_image()
|
img = frame.to_image()
|
||||||
del frame, stream
|
del frame, stream
|
||||||
|
|
||||||
img.thumbnail((maxsize, maxsize))
|
img.thumbnail((maxsize, maxsize))
|
||||||
imgdata = io.BytesIO()
|
imgdata = io.BytesIO()
|
||||||
if rotation:
|
if rotation:
|
||||||
img = img.rotate(rotation, expand=True)
|
img = img.rotate(rotation, expand=True)
|
||||||
img.save(imgdata, format="webp", quality=quality, method=4)
|
img.save(imgdata, format="webp", quality=quality, method=4)
|
||||||
|
del img
|
||||||
|
|
||||||
ret = imgdata.getvalue()
|
ret = imgdata.getvalue()
|
||||||
gc.collect()
|
gc.collect()
|
||||||
return ret
|
return ret
|
||||||
|
|
Loading…
Reference in New Issue
Block a user