more stuff
This commit is contained in:
@@ -132,13 +132,22 @@ class StreamingFrameWriter:
|
||||
bufsize=10**8 # Large buffer for performance
|
||||
)
|
||||
|
||||
# Test if ffmpeg starts successfully (quick check)
|
||||
import time
|
||||
time.sleep(0.1) # Give ffmpeg time to fail if it's going to
|
||||
|
||||
if self.ffmpeg_process.poll() is not None:
|
||||
# Process already died - read error
|
||||
stderr = self.ffmpeg_process.stderr.read().decode()
|
||||
raise RuntimeError(f"FFmpeg failed immediately: {stderr}")
|
||||
|
||||
# Set process to ignore SIGINT (Ctrl+C) - we'll handle it
|
||||
if hasattr(signal, 'pthread_sigmask'):
|
||||
signal.pthread_sigmask(signal.SIG_BLOCK, [signal.SIGINT])
|
||||
|
||||
except Exception as e:
|
||||
# Try CPU fallback if GPU encoding fails
|
||||
if 'nvenc' in self.ffmpeg_cmd:
|
||||
if 'nvenc' in ' '.join(self.ffmpeg_cmd):
|
||||
print(f"⚠️ GPU encoding failed, trying CPU fallback...")
|
||||
self.ffmpeg_cmd = self._build_ffmpeg_command('libx264', 'medium', 18)
|
||||
self._start_ffmpeg()
|
||||
|
||||
Reference in New Issue
Block a user