From dd911a79df764e29d98edea360e85a912656e3cd Mon Sep 17 00:00:00 2001 From: Meisoftcoltd <38667978+Meisoftcoltd@users.noreply.github.com> Date: Thu, 23 Apr 2026 19:47:08 +0000 Subject: [PATCH] fix(tiktok): Force H.264 (avc) codec to prevent missing audio and RAM exhaustion in WSL - Updated `get_format_string` in `__init__.py` to prioritize `[vcodec*=avc]`. - This ensures yt-dlp fetches pre-mixed video and audio formats for TikTok, instead of downloading `bytevc1` (H.265) streams which lack audio or require heavy FFmpeg merges that cause Out-of-Memory errors in WSL. --- __init__.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/__init__.py b/__init__.py index 237bc06..a29b4ef 100644 --- a/__init__.py +++ b/__init__.py @@ -149,13 +149,15 @@ class YTDLPVideoDownloader: if is_audio: return "bestaudio/best" - # 🚀 FIX: Prioridad Absoluta al archivo PRE-MEZCLADO (Video + Audio unidos de fábrica). - # Evita que FFmpeg colapse la RAM intentando fusionar pistas separadas de TikTok. + # 🚀 FIX DEFINITIVO TIKTOK/AUDIO: Forzar contenedor H.264 (avc) pre-mezclado. + # TikTok sirve el formato 'bytevc1' a menudo sin pista de audio o ilegible. + # Al exigir 'vcodec*=avc', obligamos a yt-dlp a bajar el MP4 estándar que SÍ trae el audio integrado, + # evitando además el colapso de RAM por fusión de pistas en FFmpeg. if quality == "best": - return "b[ext=mp4]/b/bestvideo+bestaudio/best" + return "best[vcodec*=avc][ext=mp4]/best[vcodec*=avc]/best[ext=mp4]/best/bestvideo+bestaudio/best" h = quality.replace("p", "") - return f"b[height<={h}][ext={ext}]/b[height<={h}]/bestvideo[height<={h}][ext={ext}]+bestaudio/best[height<={h}][ext={ext}]/best" + return f"best[height<={h}][vcodec*=avc][ext={ext}]/best[height<={h}][vcodec*=avc]/best[height<={h}]/bestvideo[height<={h}][ext={ext}]+bestaudio/best[height<={h}][ext={ext}]/best" def download_video(self, url, cookies_text, cookies_file, browser_source, update_yt_dlp, quality, format): if update_yt_dlp: