Twitch Downloader

repository·master·Indexed 24 days ago

https://github.com/lay295/twitchdownloader

A multi-platform tool featuring a Windows WPF GUI and a cross-platform CLI (TwitchDownloaderCLI) to download Twitch VODs, Clips, and Chat. It includes capabilities to render chat logs into video files with emote support (BTTV, FFZ, 7TV), concatenate MPEG Transport Stream files via tsmerge mode, and manage FFmpeg binaries.

Tokens
17.4K
Snippets
38
Records
81
Agent score
78%

What's inside Twitch Downloader

  1. Overview of Twitch Downloader capabilities

    master

    Twitch Downloader is a tool designed to download Twitch VODs, Clips, and Chat.

    Key Features:

    • Download VODs and Clips: Retrieve video content from Twitch.
    • Download Chat: Export chat from VODs or Clips into JSON (original info), HTML (browser-viewable), or plain text formats.
    • Update Chat Data: Modify previously generated JSON chat files and save them in other formats.
    • Chat Rendering: Use existing JSON chat files to render chat videos with support for:
      • Twitter Twemoji or Google Noto Color emojis.
      • Static and animated emotes from BTTV, FFZ, and 7TV.
  2. Overview of TwitchDownloaderWPF

    master

    TwitchDownloaderWPF is a Windows desktop application built using WPF. It implements the core functionality of the TwitchDownloader project and integrates several utility features designed to enhance the user experience.

    Note: This Chinese documentation may not be the most up-to-date version. If you encounter outdated information, omissions, or errors, please refer to the English version.

  3. Overview of TwitchDownloader capabilities

    master

    TwitchDownloader is a tool designed to download Twitch VODs, Clips, and Chat.

    Key features include:

    • VOD/Clip Downloading: Download video content from Twitch.
    • Chat Exporting: Save chat as a JSON file (containing all original metadata), a browser-compatible HTML file, or a plain text file.
    • Chat Updating: Update existing JSON chat files and re-save them in different formats.
    • Chat Rendering: Play back chat using JSON files with support for Twitter Twemoji, Google Noto Color emojis, and BTTV, FFZ, or 7TV (static and animated) emojis.
  4. Build Twitch Downloader from source

    master

    Requirements

    Build Instructions

    1. Clone the repository:
    git clone https://github.com/lay295/TwitchDownloader.git
    cd TwitchDownloader
    1. Restore the solution:
    dotnet restore

    Note: Non-Windows devices must specify a project to restore, e.g., dotnet restore TwitchDownloaderCLI.

    1. Build the GUI:
    dotnet publish TwitchDownloaderWPF -p:PublishProfile=Windows
    1. Build the CLI (replace <Profile> with your target platform):
    dotnet publish TwitchDownloaderCLI -p:PublishProfile=<Profile>

    Available Profiles: Windows, Linux, LinuxAlpine, LinuxArm, LinuxArm64, MacOS, MacOSArm64.

    Output Locations

    • GUI: TwitchDownloaderWPF/bin/Release/net10.0-windows/publish/win-x64
    • CLI: TwitchDownloaderCLI/bin/Release/net10.0/publish
    git clone https://github.com/lay295/TwitchDownloader.git
    cd TwitchDownloader
    dotnet restore
    dotnet publish TwitchDownloaderWPF -p:PublishProfile=Windows
    dotnet publish TwitchDownloaderCLI -p:PublishProfile=Linux
  5. Configure Rendering Prerequisites for Linux

    master

    Linux users must ensure fontconfig and libfontconfig1 are installed for proper rendering. On Ubuntu, use:

    apt-get install fontconfig libfontconfig1

    If your distribution (like Alpine Linux) lacks support for specific language fonts (e.g., Arabic, Persian, Thai), you may need to install additional font families like Noto.

  6. Update or Convert JSON Chat Files

    master

    Use the Chat-Aktualisierung tool to update embedded emotes/badges/bits in a JSON chat or convert a JSON chat to another format.

    Steps:

    1. Click Durchsuchen (Browse) and select a previously downloaded JSON chat.
    2. Configure options and click Aktualisieren (Update).

    Options:

    • Downloadformat: JSON, Text, or HTML.
    • Komprimierung: (JSON only) GZip compression.
    • Zeitstempelformat: (Text only) UTC, Relative, or None.
    • Trimmen: Set start/end times. Expanding the range attempts to fetch missing comments; shortening does not remove comments.
    • Fehlendes einbetten (Embed Missing): (JSON & HTML) Downloads emotes/badges not present in the original JSON.
    • Einbettungen ersetzen (Replace Embeddings): (JSON & HTML) Removes existing emotes/badges and downloads current ones.
    • Emotes von Drittanbietern: (JSON & HTML) Downloads additional third-party emotes.
  7. Install Twitch Downloader CLI on Linux

    master
    1. Ensure fontconfig and libfontconfig1 are installed (e.g., apt-get install fontconfig libfontconfig1 on Ubuntu). If using Alpine Linux, ensure you have installed additional fonts like Noto.
    2. Download the latest Linux binary from Releases or use the AUR package for Arch Linux.
    3. Extract the TwitchDownloaderCLI binary.
    4. Navigate to the directory and grant execution permissions:
    sudo chmod +x TwitchDownloaderCLI
    1. If FFmpeg is not installed system-wide, download it via the CLI:
    ./TwitchDownloaderCLI ffmpeg --download
    1. Run a download command:
    ./TwitchDownloaderCLI videodownload --id <vod-id-here> -o out.mp4
    sudo chmod +x TwitchDownloaderCLI
    ./TwitchDownloaderCLI ffmpeg --download
    ./TwitchDownloaderCLI videodownload --id <vod-id-here> -o out.mp4
  8. Install and setup TwitchDownloader CLI on Linux

    master
    1. Ensure fontconfig and libfontconfig1 are installed (e.g., sudo apt-get install fontconfig libfontconfig1 on Ubuntu). If using distributions like Alpine, ensure Noto fonts are installed for proper emoji/text rendering.
    2. Download the latest Linux binary from Releases or use the AUR package for Arch Linux.
    3. Extract TwitchDownloaderCLI and grant execution permissions:
      sudo chmod +x TwitchDownloaderCLI
    4. Install FFmpeg via your package manager or use the CLI:
      ./TwitchDownloaderCLI ffmpeg --download
      If you downloaded FFmpeg manually, grant it permissions: sudo chmod +x ffmpeg.
    5. Run a download command:
      ./TwitchDownloaderCLI videodownload --id <vod-id-here> -o out.mp4
    sudo chmod +x TwitchDownloaderCLI
    ./TwitchDownloaderCLI ffmpeg --download
    ./TwitchDownloaderCLI videodownload --id <vod-id-here> -o out.mp4
  9. Download Twitch VODs and Highlights

    master

    To download VODs or Highlights, enter a valid link or ID.

    Key Options:

    • Quality: Select desired resolution. Note that Twitch may label the highest quality as "Source" instead of a standard resolution (e.g., 1080p60).
    • Trim Mode: Choose between "Precise" (may cause audio/video stuttering at start/end) or "Safe" (avoids stuttering but may result in a slightly longer video).
    • Trim: Set start and end times using the [HH] [MM] [SS] format to reduce download size.
    • Download Threads: Set the number of parallel download threads.
    • OAuth: Required for downloading private or subscriber-only content. Do not share your OAuth token with anyone.

    Use the Download button to start immediately or Enqueue to add the task to the Task Queue.

  10. Render Chat JSON to Video

    master

    Convert a JSON chat file into a video file.

    1. Click Browse and select a JSON chat file.
    2. Configure General settings:
      • Width / Height: Must be even numbers.
      • Font: e.g., Inter Embedded.
      • Font Size, Font Color, Background Color, Alt Background Color.
    3. Configure Rendering settings:
      • Outline: Black outline for usernames/messages.
      • Timestamps: Relative timestamps next to messages.
      • Sub Messages: Include/filter sub, resub, and sub gift messages.
      • Chat Badges: Draw badges next to usernames.
      • Update Rate: Seconds between batches (lower = smoother but slower).
      • Dispersion: Restores message timing (requires update rate < 1.0).
      • Alternate Backgrounds: Alternates colors for message rows.
      • Increase Username Visibility: Increases contrast.
      • Emotes: Enable BTTV, FFZ, or 7TV emotes.
      • Offline: Use only embedded data (no network requests).
      • User Avatars: Enable user avatars.
      • Chat Badge Filter: List badges to exclude.
      • Ignore Users List: Comma-separated list of users to remove.
      • Banned Words List: Comma-separated list of words to remove.
      • Emoji Vendor: Twemoji, Noto Color, or None (system).
    4. Configure Scaling (Emotes, Badges, Emojis, Avatars, Outlines, Spacing, etc.).
    5. Configure Encoding:
      • File Format, Codec, Framerate.
      • Generate Mask: Creates a B&W mask (requires background alpha < 255).
      • Sharpening: Applies sharpening filter.
    6. Configure FFmpeg (Input/Output arguments).
    7. Click Render or Enqueue (use Partial Render for specific sections).