From fdbf9b26108f813be8ac7f18a033be35aa3211c8 Mon Sep 17 00:00:00 2001 From: Leo Vasanko Date: Tue, 21 Nov 2023 12:26:16 +0000 Subject: [PATCH] Attempt to reduce leak of ffmpeg previews --- cista/preview.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cista/preview.py b/cista/preview.py index 0a82d2e..bf9eb2d 100644 --- a/cista/preview.py +++ b/cista/preview.py @@ -98,8 +98,9 @@ def process_pdf(path, *, maxsize, maxzoom, quality, page_number=0): def process_video(path, *, maxsize, quality): with av.open(str(path)) as container: stream = container.streams.video[0] - rot = stream.side_data and stream.side_data.get(SideData.DISPLAYMATRIX) or 0 stream.codec_context.skip_frame = "NONKEY" + stream.codec_context.threads = 1 + rot = stream.side_data and stream.side_data.get(SideData.DISPLAYMATRIX) or 0 container.seek(container.duration // 8) img = next(container.decode(stream)).to_image() del stream