Add NVIDIA support for FFmpeg in Docker and enhance chat rendering functionality
All checks were successful
Publish Twitch Archive Container / publish (push) Successful in 7m36s

- Introduced a new docker-compose.nvidia.yml for NVIDIA GPU support.
- Updated dockerstart.bat to allow optional NVIDIA runtime.
- Enhanced ContentDownloader to manage chat rendering status and font settings.
- Improved hardware acceleration detection in utils.py.
- Added tests for hardware acceleration and chat rendering behavior.

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
MaddoScientisto 2026-04-25 12:28:59 +02:00
commit ec44981a9d
8 changed files with 226 additions and 18 deletions

View file

@ -4,6 +4,7 @@ Includes fallback support for chat_downloader when VOD-based methods fail.
"""
import os
import sys
import subprocess
import json
import threading
@ -45,6 +46,10 @@ class ContentDownloader:
self.download_live_chat_enabled = config.get('downloadLiveCHAT', True)
self.use_chat_downloader_primary = config.get('useChatDownloaderPrimary', False)
self.use_chat_downloader_fallback = config.get('useChatDownloaderFallback', True)
default_chat_font = 'Arial' if sys.platform.startswith('win') else 'DejaVu Sans'
self.chat_render_font = config.get('chat_render_font', default_chat_font)
self.last_chat_render_attempted = False
self.last_chat_render_succeeded = False
# Initialize chat_downloader if available
self.chat_downloader = None
@ -61,6 +66,11 @@ class ContentDownloader:
self.chat_thread = None
self.chat_thread_success = False
self.chat_thread_error = None
def reset_chat_render_status(self) -> None:
"""Reset chat render tracking before a processing pass."""
self.last_chat_render_attempted = False
self.last_chat_render_succeeded = False
def download_vod(self, vod_info: Dict[str, Any], output_path: str) -> bool:
"""
@ -190,7 +200,7 @@ class ContentDownloader:
'-h', '1080',
'--framerate', '30',
'--outline',
'-f', 'Arial',
'-f', self.chat_render_font,
'--font-size', '22',
'--update-rate', '1.0',
'--offline',
@ -215,6 +225,9 @@ class ContentDownloader:
try:
print(f'{Fore.YELLOW}Rendering chat video...{Style.RESET_ALL}')
print(f'{Fore.CYAN}Using chat font: {self.chat_render_font}{Style.RESET_ALL}')
self.last_chat_render_attempted = True
self.last_chat_render_succeeded = False
# Build complete command
full_cmd = [self.twitch_downloader_path, 'chatrender', '-i', json_path, '-o', video_path] + chat_settings
@ -249,6 +262,7 @@ class ContentDownloader:
print(f'{Fore.RED}✗ Chat video file is too small ({file_size} bytes){Style.RESET_ALL}')
return False
self.last_chat_render_succeeded = True
print(f'{Fore.GREEN}✓ Chat rendered ({file_size:,} bytes){Style.RESET_ALL}')
return True