Setting Up Bilistream: System Requirements, Installation, and Configuration Guide

Setting up Bilistream requires FFmpeg, Python 3 with yt-dlp, a valid config.yaml with Bilibili authentication cookies, and either Docker or the Rust toolchain to run the application.

Bilistream is a Rust-based relay tool that automatically streams content from Twitch or YouTube (including preview-type live streams) to Bilibili. Before you can launch the application from the limitcool/bilistream repository, you must satisfy several system-level dependencies and provide specific authentication credentials.

System Requirements

Bilistream operates as a bridge between external streaming platforms and Bilibili, which necessitates specific binaries and runtime environments for stream processing and API communication.

Core Dependencies

Regardless of your deployment method, the following must be present on your host system:

  • FFmpeg – Handles the actual stream ingestion from source platforms and RTMP push to Bilibili servers.
  • Python 3 and pip – Required to install yt-dlp, which Bilistream uses internally to extract direct stream URLs from Twitch and YouTube.
  • yt-dlp – Install via pip3 install -U yt-dlp to enable platform-specific stream URL extraction.

If building from source rather than using Docker, you also need the Rust toolchain. According to Cargo.toml in the repository root, the project requires cargo version 1.56 or higher and uses the Rust 2021 edition.

Optional Components

  • Docker and Docker Compose – Provides the simplest deployment path via the pre-built image ghcr.io/limitcool/bilistream:latest.
  • Gotify server – Required only if you want push notifications when streams start.
  • Netscape-format cookies.txt – Optional file exported from your browser to authenticate with Twitch or YouTube for restricted content.

Installation Methods

You can deploy Bilistream either as a containerized application or as a native binary compiled from the Rust source.

The Docker approach eliminates the need to install Rust or manage Python dependencies manually. Create a docker-compose.yaml file that mounts your configuration:

services:
  bilistream:
    image: ghcr.io/limitcool/bilistream:latest
    container_name: bilistream
    volumes:
      - ./config.yaml:/app/config.yaml:ro
      - ./cookies.txt:/app/cookies.txt:ro
    restart: unless-stopped
    environment:
      - TZ=Asia/Shanghai
      # Uncomment if you need an HTTP proxy for FFmpeg outside China

      # - http_proxy=http://host.docker.internal:7890

This configuration mounts config.yaml as read-only and optionally includes a cookies file for platform authentication.

Building from Source

To compile the binary yourself, first ensure FFmpeg and Python 3 are installed, then execute:


# Install Rust via rustup if not present

# Clone the repository

git clone https://github.com/limitcool/bilistream.git
cd bilistream

# Build release binary

cargo build --release

# Install Python dependency

pip3 install -U yt-dlp

# Run the binary

./target/release/bilistream

The entry point at src/main.rs orchestrates configuration loading, live-status polling, and FFmpeg process management.

Configuration File Structure

Bilistream expects a config.yaml file in the working directory. The structure is defined in src/config.rs, which parses the YAML into a Config struct at runtime.

Required Bilibili Credentials

You must extract specific cookie values from your Bilibili account and provide your target room details:

Interval: 60
Platform: Twitch
BiliLive:
  SESSDATA: "<your_sessdata_cookie>"
  bili_jct: "<your_bili_jct_cookie>"
  DedeUserID: "2235894"
  DedeUserID__ckMd5: "<hash_value>"
  Room: 660428
  BiliRtmpUrl: "rtmp://live-push.bilivideo.com/live-bvc/"
  BiliRtmpKey: "?streamname=live_0000000_0000000&key=xxxxxxxxxx..."

The SESSDATA, bili_jct, DedeUserID, and DedeUserID__ckMd5 fields are mandatory for Bilibili authentication, while Room identifies your target live room ID.

Platform-Specific Settings

Configure the source platform under the respective key:

  • Twitch: Set Twitch.Room to your channel name.
  • YouTube: Use Platform: Youtube or YoutubePreviewLive for specific stream types.

Network Proxy and Notifications

If your server resides outside mainland China, configure the FfmpegProxy field to route FFmpeg traffic through an accessible HTTP proxy:

FfmpegProxy: "http://127.0.0.1:7890"

For Gotify notifications, include:

Gotify:
  Url: "https://example.com/gotify"
  Token: "your_application_token"

Optionally specify a cookies file path for YouTube or Twitch authentication:

Cookies: "/app/cookies.txt"

Summary

  • Setting up Bilistream requires FFmpeg, Python 3 with yt-dlp, and a properly structured config.yaml containing Bilibili session cookies.
  • The application supports two deployment paths: Docker (recommended for simplicity) or building from source with Cargo (requires Rust toolchain ≥ 1.56).
  • Critical configuration fields in config.yaml include SESSDATA, bili_jct, Room, BiliRtmpUrl, and BiliRtmpKey under the BiliLive section.
  • External servers may need FfmpegProxy configured to successfully pull streams from Twitch or YouTube.
  • Optional features include Gotify push notifications and browser cookie files for platform authentication.

Frequently Asked Questions

Do I need Rust installed if using Docker?

No. The Docker image ghcr.io/limitcool/bilistream:latest contains a pre-compiled binary, so you only need Docker and Docker Compose. Rust is only required when building from source using cargo build --release as specified in Cargo.toml.

What format should the cookies.txt file use?

Bilistream expects a Netscape HTTP Cookie File format. You can export this format from most browsers using extensions like "Get cookies.txt" or similar tools. Place the file at the path specified in the Cookies field of your config.yaml and mount it into the Docker container if applicable.

How do I obtain the required Bilibili cookies?

Log into Bilibili via web browser, open developer tools (F12), navigate to Application/Storage > Cookies, and copy the values for SESSDATA, bili_jct, DedeUserID, and DedeUserID__ckMd5. Paste these into the BiliLive section of config.yaml as defined in src/config.rs.

Can I run Bilistream on a server outside China?

Yes, but you will likely need to configure FfmpegProxy in config.yaml with a China-accessible HTTP proxy. This allows the FFmpeg process to successfully establish connections to Bilibili's RTMP push servers, which may have connectivity issues from certain international networks.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →