Skip to content

Conversation

@Ixian
Copy link

@Ixian Ixian commented Nov 15, 2025

Fix YouTube Downloads - Issue #224

Problem

YouTube downloads were failing with "exit status 1" error. Root cause: YouTube now requires yt-dlp to use a JavaScript runtime for video cipher decryption (see yt-dlp/yt-dlp#14404).

Solution

1. Install Deno Runtime

Added Deno installation to both Dockerfiles (standard and CUDA) since YouTube requires JavaScript execution for video decryption.

Files: Dockerfile lines 71-77, Dockerfile.cuda lines 74-80

# Install Deno (JavaScript runtime required for yt-dlp YouTube downloads)
# YouTube now requires JS execution for video cipher decryption
# See: https://github.com/yt-dlp/yt-dlp/issues/14404
RUN curl -fsSL https://deno.land/install.sh | sh \
  && cp /root/.deno/bin/deno /usr/local/bin/deno \
  && chmod 755 /usr/local/bin/deno \
  && deno --version

2. Upgrade to yt-dlp[default]

Changed from yt-dlp to yt-dlp[default] to include all optional dependencies (brotli, pycryptodomex, websockets, mutagen).

File: internal/transcription/adapters/whisperx_adapter.go line 349

3. Add Error Diagnostics

Added stderr capture to YouTube download command to surface actual yt-dlp errors instead of generic "exit status 1" messages.

File: internal/api/handlers.go lines 2700-2753

var stderr bytes.Buffer
ytDlpCmd.Stderr = &stderr

if err := ytDlpCmd.Run(); err != nil {
    stderrOutput := stderr.String()
    logger.Error("YouTube download failed",
        "error", err.Error(),
        "stderr", stderrOutput)
    c.JSON(http.StatusInternalServerError, gin.H{
        "error":   fmt.Sprintf("Failed to download YouTube audio: %v", err),
        "details": stderrOutput,
    })
    return
}

4. Add Performance Logging

Added timing metrics for YouTube downloads to identify bottlenecks.

File: internal/api/handlers.go - Download timing and file size logging

Testing

Manual verification:

  • Deno runtime installed and accessible in container
  • yt-dlp[default] with all dependencies installed
  • YouTube downloads working successfully
  • Error capture properly surfacing stderr output
  • Performance logging operational

Test case: 30-minute YouTube video

  • Download: ~20 seconds
  • Title retrieval: 1-2 seconds
  • WhisperX transcription: 12.49x realtime on RTX GPU
  • PyAnnote diarization: ~14 minutes
  • Total: 16m40s end-to-end

Files Modified

  1. Dockerfile - Added Deno installation
  2. Dockerfile.cuda - Added Deno installation
  3. internal/api/handlers.go - Added stderr capture and YouTube performance logging
  4. internal/transcription/adapters/whisperx_adapter.go - Changed to yt-dlp[default]

Related Issues

Closes #224

YouTube downloads were failing with "exit status 1" error. Root cause:
YouTube now requires yt-dlp to use a JavaScript runtime for video cipher
decryption.

Changes:
- Install Deno runtime in both Dockerfiles (standard and CUDA)
- Upgrade from yt-dlp to yt-dlp[default] to include all optional dependencies
- Add stderr capture to YouTube download handler for better error diagnostics
- Add performance logging for YouTube downloads (timing and file size)

Fixes rishikanthc#224

See: yt-dlp/yt-dlp#14404
@Ixian Ixian mentioned this pull request Nov 15, 2025
@rishikanthc rishikanthc merged commit c2d29fc into rishikanthc:main Nov 15, 2025
@rishikanthc
Copy link
Owner

Thank you so much for your contribution. Once again stellar work just like the gpu PR. Appreciate the time and help :)

@Ixian Ixian deleted the fix/youtube-dl-issue-224 branch November 15, 2025 23:13
@sjsamdrake
Copy link

Great that it's fixed. When might this make it into the :latest container image? Thanks!

@rishikanthc rishikanthc added this to the v1.2.0 milestone Dec 5, 2025
@rishikanthc rishikanthc added the bug Something isn't working label Dec 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

YouTube downloads fail

3 participants