diff --git a/videoarchiver/processor.py b/videoarchiver/processor.py index 76f2665..b707b2b 100644 --- a/videoarchiver/processor.py +++ b/videoarchiver/processor.py @@ -317,7 +317,6 @@ class VideoProcessor: return # Find all video URLs in message using yt-dlp simulation - logger.info(f"Checking message {message.id} for video URLs...") urls = [] if message.guild.id in self.components: downloader = self.components[message.guild.id]["downloader"] @@ -327,10 +326,11 @@ class VideoProcessor: # Use yt-dlp simulation to check if URL is supported try: if downloader.is_supported_url(word): - logger.info(f"Found supported URL: {word}") urls.append(word) except Exception as e: - logger.error(f"Error checking URL {word}: {str(e)}") + # Only log URL check errors if it's actually a URL + if any(site in word for site in ["http://", "https://", "www."]): + logger.error(f"Error checking URL {word}: {str(e)}") continue if urls: @@ -341,8 +341,6 @@ class VideoProcessor: priority = len(urls) - i logger.info(f"Processing URL {url} with priority {priority}") await self.process_video_url(url, message, priority) - else: - logger.info(f"No video URLs found in message {message.id}") except Exception as e: logger.error(f"Error processing message: {traceback.format_exc()}") diff --git a/videoarchiver/utils/video_downloader.py b/videoarchiver/utils/video_downloader.py index c0fabd0..a4ba7f4 100644 --- a/videoarchiver/utils/video_downloader.py +++ b/videoarchiver/utils/video_downloader.py @@ -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):