correct ffmpeg command
This commit is contained in:
parent
6f75a645b7
commit
9daa45789d
|
|
@ -220,12 +220,17 @@ async def s_api_v1_storage_get(request, file_hash=None):
|
||||||
subprocess.run([
|
subprocess.run([
|
||||||
"ffmpeg",
|
"ffmpeg",
|
||||||
"-y",
|
"-y",
|
||||||
|
"-ss", "0", # Set start time if needed
|
||||||
"-i", file_path,
|
"-i", file_path,
|
||||||
"-t", str(seconds_limit),
|
"-t", str(seconds_limit),
|
||||||
"-c:v", "libx264",
|
"-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
|
"-pix_fmt", "yuv420p", # Set pixel format for compatibility
|
||||||
"-c:a", "aac",
|
"-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
|
tempfile_path
|
||||||
], check=True)
|
], check=True)
|
||||||
else:
|
else:
|
||||||
|
|
@ -235,9 +240,13 @@ async def s_api_v1_storage_get(request, file_hash=None):
|
||||||
"-y",
|
"-y",
|
||||||
"-i", file_path,
|
"-i", file_path,
|
||||||
"-c:v", "libx264",
|
"-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
|
"-pix_fmt", "yuv420p", # Set pixel format for compatibility
|
||||||
"-c:a", "aac",
|
"-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
|
tempfile_path
|
||||||
], check=True)
|
], check=True)
|
||||||
except BaseException as e:
|
except BaseException as e:
|
||||||
|
|
|
||||||
|
|
@ -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.
|
# 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 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:
|
try:
|
||||||
# Construct URL for trimmed preview (limit to 30 seconds)
|
# 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"
|
preview_url = f"{PROJECT_HOST}/api/v1/storage/{content.cid.serialize_v2(include_accept_type=True)}?seconds_limit=30"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue