From 222d014385b0b2df43e691862caef92fb689189b Mon Sep 17 00:00:00 2001 From: user Date: Wed, 5 Feb 2025 11:54:54 +0300 Subject: [PATCH] correct ffmpeg command --- app/api/routes/node_storage.py | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/app/api/routes/node_storage.py b/app/api/routes/node_storage.py index 2ff4346..75ae897 100644 --- a/app/api/routes/node_storage.py +++ b/app/api/routes/node_storage.py @@ -220,17 +220,12 @@ async def s_api_v1_storage_get(request, file_hash=None): subprocess.run([ "ffmpeg", "-y", - "-ss", "0", # Set start time if needed + "-ss", "0", # Seek to start (fast seeking) "-i", file_path, - "-t", str(seconds_limit), - "-c:v", "libx264", - "-preset", "medium", # Set encoding preset for better compatibility - "-profile:v", "main", # Set profile for compatibility - "-pix_fmt", "yuv420p", # Set pixel format for compatibility - "-c:a", "aac", - "-b:a", "192k", # Set audio bitrate - "-movflags", "+faststart", # Enable fast start for streaming - "-map", "0", # Map all streams from the input + "-t", str(seconds_limit), # Set the duration of the output + "-c:v", "libx264", # Encode video with libx264 + "-c:a", "aac", # Encode audio with AAC + "-movflags", "+faststart", # Enable fast start for streaming tempfile_path ], check=True) else: @@ -238,15 +233,11 @@ async def s_api_v1_storage_get(request, file_hash=None): subprocess.run([ "ffmpeg", "-y", + "-ss", "0", # Seek to start (fast seeking) "-i", file_path, - "-c:v", "libx264", - "-preset", "medium", # Set encoding preset for better compatibility - "-profile:v", "main", # Set profile for compatibility - "-pix_fmt", "yuv420p", # Set pixel format for compatibility - "-c:a", "aac", - "-b:a", "192k", # Set audio bitrate - "-movflags", "+faststart", # Enable fast start for streaming - "-map", "0", # Map all streams from the input + "-c:v", "libx264", # Encode video with libx264 + "-c:a", "aac", # Encode audio with AAC + "-movflags", "+faststart", # Enable fast start for streaming tempfile_path ], check=True) except BaseException as e: