From 5f4d90d410247818e5e176dd6a84fcef610b5102 Mon Sep 17 00:00:00 2001 From: user Date: Wed, 5 Feb 2025 11:59:44 +0300 Subject: [PATCH] correct ffmpeg command --- app/api/routes/node_storage.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/app/api/routes/node_storage.py b/app/api/routes/node_storage.py index 75ae897..6c88184 100644 --- a/app/api/routes/node_storage.py +++ b/app/api/routes/node_storage.py @@ -220,11 +220,15 @@ async def s_api_v1_storage_get(request, file_hash=None): subprocess.run([ "ffmpeg", "-y", - "-ss", "0", # Seek to start (fast seeking) + "-ss", "0", # Set start time (fast seeking) "-i", file_path, - "-t", str(seconds_limit), # Set the duration of the output + "-t", str(seconds_limit), # Set duration of the output "-c:v", "libx264", # Encode video with libx264 + "-profile:v", "baseline", # Set baseline profile for compatibility with Telegram + "-level", "3.0", # Set level to 3.0 for compatibility + "-pix_fmt", "yuv420p", # Set pixel format for maximum compatibility "-c:a", "aac", # Encode audio with AAC + "-b:a", "128k", # Set audio bitrate "-movflags", "+faststart", # Enable fast start for streaming tempfile_path ], check=True) @@ -233,10 +237,15 @@ async def s_api_v1_storage_get(request, file_hash=None): subprocess.run([ "ffmpeg", "-y", - "-ss", "0", # Seek to start (fast seeking) + "-ss", "0", # Set start time (fast seeking) "-i", file_path, + # "-t", str(seconds_limit), # Set duration of the output "-c:v", "libx264", # Encode video with libx264 + "-profile:v", "baseline", # Set baseline profile for compatibility with Telegram + "-level", "3.0", # Set level to 3.0 for compatibility + "-pix_fmt", "yuv420p", # Set pixel format for maximum compatibility "-c:a", "aac", # Encode audio with AAC + "-b:a", "128k", # Set audio bitrate "-movflags", "+faststart", # Enable fast start for streaming tempfile_path ], check=True)