PROJECT 6 COMPLETED

AI Crypto Live Stream — 24/7 Autonomous Trading on YouTube

A production livestream service that captures the AI crypto trading dashboard and streams it 24/7 to YouTube — built with Chromium headless, Xvfb, FFmpeg, and deployed on Railway.

Node.jsChromium HeadlessXvfbFFmpegx11grabH264AACRTMPRailwayDockerYouTube Live API

SCREENSHOTS

Screenshot 1
Screenshot 2
Screenshot 3

Research Question

Can a fully autonomous AI trading agent stream its own decision-making process live to YouTube 24/7 without any human intervention?

Video Walkthrough

Key Results

  • Stream resolution: 1920x1080 (1080p)

  • Frame rate: 30fps

  • Video bitrate: 6800kbps target

  • Audio bitrate: 128kbps AAC stereo

  • Stream uptime: 24/7 autonomous

  • Build time: ~4 minutes (Docker image with FFmpeg + Chromium)

  • Monthly running cost: ~$10-15 on Railway Pro

  • Time to build: single Claude Code session

  • Stream latency: Normal (YouTube default)

Architecture

Railway Container (livestream service) │ ├── Xvfb :99 (Virtual Display 1920x1080) │ └── Chromium (kiosk mode) │ └── https://crypto-dashboard-production-a22f.up.railway.app/live │ ├── FFmpeg │ ├── Input 1: x11grab from :99.0+0,0 (video) │ ├── Input 2: background.mp3 loop (audio) │ └── Output: rtmp://x.rtmp.youtube.com/live2/[key] │ ├── Video: H264 6800kbps 1080p30 │ └── Audio: AAC 128kbps stereo │ └── Auto-restart on crash (browser.js + stream.js) YouTube Live └── https://youtube.com/live/KtYI7Q8Sx_E

Case Study

The Problem

The AI crypto trading experiment from Day 05 was running 24/7 on Railway, making autonomous trading decisions every 15 minutes — but nobody could watch it in real time unless they visited the dashboard URL directly.

The challenge: how do you make an autonomous AI agent's decision-making process publicly visible and watchable 24/7 without any human operating a streaming setup?

The Solution

A dedicated livestream microservice that:

1. Launches a headless Chromium browser rendering the /live dashboard
2. Creates a virtual display using Xvfb (X Virtual Framebuffer)
3. Captures the display in real time using FFmpeg x11grab
4. Encodes to H264 video + AAC audio at 6800kbps
5. Streams continuously to YouTube via RTMP
6. Auto-restarts if any component crashes
7. Loops background lofi music for 24 hours

The Architecture

The service runs entirely on Railway as a Docker container with no human intervention required after deployment.

Key Challenges Solved

Challenge 1 — Headless browser rendering
Chromium requires a display to render. Solution: Xvfb creates a virtual 1920x1080 display that Chromium renders into, even though there is no physical screen.

Challenge 2 — FFmpeg x11grab
x11grab captures the virtual display in real time. The -draw_mouse flag caused errors in this FFmpeg version and had to be removed.

Challenge 3 — Static content bitrate
A dark dashboard with text and charts is highly compressible — H264 naturally encodes it at 2500-3000kbps even when targeting 6800kbps. The stillimage tune optimizes for this content type.

Challenge 4 — Auto-restart
Both browser.js and stream.js implement auto-restart on crash, ensuring the stream recovers automatically without human intervention.

Challenge 5 — Copyright-safe music
YouTube Audio Library tracks were used for background music — committed directly to the repo and processed by FFmpeg into a 2-hour loop at build time.

What Makes This Day 06

This is the first time in the series that an AI agent streams its own operation publicly. The stream shows:

  • Real-time portfolio equity curve vs BTC and ETH benchmarks

  • Live BUY/SELL/HOLD decisions with AI reasoning

  • Current holdings with P&L

  • Agent activity feed

  • Next evaluation countdown


Everything visible on stream is generated autonomously by the AI — no human writes the decisions, no human operates the stream.

Key Findings & Learnings

  • Headless Chromium + Xvfb is a viable production approach for streaming web dashboards

  • Static/dark UI content naturally compresses below target bitrate — stillimage tune helps

  • Railway Pro tier required for real-time H264 encoding at 1080p30

  • YouTube Audio Library is the safest source for stream background music (no Content ID)

  • Auto-restart at both browser and FFmpeg level is essential for 24/7 reliability

  • The -draw_mouse flag is not supported in FFmpeg 5.1.8 x11grab and must be omitted

  • Docker build time increases significantly when processing audio with FFmpeg at build time
Personal technical research experiment. All observations are from controlled testing environments. Not financial advice.
● Live AI Trading
PortfolioLoading…
P&L—
Trades—
Open Dashboard →