diff --git a/app/api/routes/node_storage.py b/app/api/routes/node_storage.py index 654f163..2ff4346 100644 --- a/app/api/routes/node_storage.py +++ b/app/api/routes/node_storage.py @@ -220,12 +220,17 @@ async def s_api_v1_storage_get(request, file_hash=None): subprocess.run([ "ffmpeg", "-y", + "-ss", "0", # Set start time if needed "-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", - "-movflags", "+faststart", + "-b:a", "192k", # Set audio bitrate + "-movflags", "+faststart", # Enable fast start for streaming + "-map", "0", # Map all streams from the input tempfile_path ], check=True) else: @@ -235,9 +240,13 @@ async def s_api_v1_storage_get(request, file_hash=None): "-y", "-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", - "-movflags", "+faststart", + "-b:a", "192k", # Set audio bitrate + "-movflags", "+faststart", # Enable fast start for streaming + "-map", "0", # Map all streams from the input tempfile_path ], check=True) except BaseException as e: diff --git a/app/client_bot/routers/content.py b/app/client_bot/routers/content.py index e16ccb7..52319ca 100644 --- a/app/client_bot/routers/content.py +++ b/app/client_bot/routers/content.py @@ -135,7 +135,7 @@ async def t_inline_query_node_content(query: types.InlineQuery, memory=None, use # Check if a preview file_id is cached for audio/video and if not, upload a trimmed preview to cache it. if content_type_declared in ('audio', 'video'): - if not encrypted_content.meta.get('telegram_file_cache_preview'): + if True or not encrypted_content.meta.get('telegram_file_cache_preview'): try: # Construct URL for trimmed preview (limit to 30 seconds) preview_url = f"{PROJECT_HOST}/api/v1/storage/{content.cid.serialize_v2(include_accept_type=True)}?seconds_limit=30"