mirror of
https://github.com/pacnpal/Pac-cogs.git
synced 2025-12-20 10:51:05 -05:00
Fixed FFmpeg/FFprobe Integration:
Added proper ffprobe binary download alongside FFmpeg Added proper path handling for both binaries Added verification of both binaries Fixed FFmpeg compression by using subprocess directly instead of ffmpeg-python Improved URL Detection: Switched from regex patterns to yt-dlp simulation for URL detection Added better error handling for URL checking Added detailed logging of URL detection results Reduced Logging Noise: Only log when a message contains a video URL Only log URL check errors for actual URLs (containing http://, https://, or www.) Removed unnecessary debug logging
This commit is contained in:
@@ -269,19 +269,28 @@ class VideoDownloader:
|
||||
f"compressed_{os.path.basename(original_file)}",
|
||||
)
|
||||
|
||||
# Configure ffmpeg with optimal parameters
|
||||
stream = ffmpeg.input(original_file)
|
||||
stream = ffmpeg.output(stream, compressed_file, **params)
|
||||
|
||||
# Run FFmpeg directly with subprocess instead of ffmpeg-python
|
||||
cmd = [
|
||||
self.ffmpeg_mgr.get_ffmpeg_path(),
|
||||
"-i", original_file
|
||||
]
|
||||
|
||||
# Add all parameters
|
||||
for key, value in params.items():
|
||||
cmd.extend([f"-{key}", str(value)])
|
||||
|
||||
# Add output file
|
||||
cmd.append(compressed_file)
|
||||
|
||||
# Run compression in executor
|
||||
await asyncio.get_event_loop().run_in_executor(
|
||||
self.download_pool,
|
||||
lambda: ffmpeg.run(
|
||||
stream,
|
||||
capture_stdout=True,
|
||||
capture_stderr=True,
|
||||
overwrite_output=True,
|
||||
),
|
||||
lambda: subprocess.run(
|
||||
cmd,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
check=True
|
||||
)
|
||||
)
|
||||
|
||||
if not os.path.exists(compressed_file):
|
||||
|
||||
Reference in New Issue
Block a user