From 03d0602b0ce8b37c14dd5986be4c5d5db12841db Mon Sep 17 00:00:00 2001 From: Victor Mylle Date: Tue, 7 Mar 2023 11:46:53 +0000 Subject: [PATCH] Trying to fix blocking process --- backend/src/routers/signvideo.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/src/routers/signvideo.py b/backend/src/routers/signvideo.py index a9ce4f9..3608c79 100644 --- a/backend/src/routers/signvideo.py +++ b/backend/src/routers/signvideo.py @@ -1,3 +1,4 @@ +import asyncio import base64 import datetime import io @@ -66,7 +67,8 @@ async def sign_video( f.write(video.file.read()) command = ['ffmpeg', '-y', '-i', settings.DATA_PATH + "/" + video.filename + ".test", '-c:v', 'libx264', '-c:a', 'aac', '-strict', '-2', '-b:a', '192k', '-c:a', 'aac', '-strict', '-2', '-b:a', '192k', settings.DATA_PATH + "/" + video.filename] - subprocess.run(command, check=True) + process = await asyncio.create_subprocess_exec(*command) + await process.wait() # delete the temporary file os.remove(settings.DATA_PATH + "/" + video.filename + ".test")