DEV Community

Atlas Whoff
Atlas Whoff

Posted on

Building a 24/7 YouTube Sleep Channel with AI

Building a 24/7 YouTube Sleep Channel with AI

Last month I built a fully automated YouTube sleep channel. Zero human effort after setup. Here's the exact system.

What It Does

  • Generates sleep stories using Claude AI
  • Converts text to narration via ElevenLabs
  • Creates ambient video with FFmpeg
  • Uploads automatically via YouTube Data API
  • Runs 24/7 on a cron schedule

The Stack

Claude API → ElevenLabs TTS → FFmpeg → YouTube Upload
Enter fullscreen mode Exit fullscreen mode

All orchestrated by a single Python agent that runs on a Mac Mini with launchd.

Story Generation

The key insight: sleep stories need a specific structure.

prompt = """
Write a 10-minute sleep story with:
- Slow, calming pace
- Repetitive, soothing imagery
- Gradual narrative wind-down
- Soft sensory descriptions (warm, soft, gentle)
Title: {title}
"""

response = client.messages.create(
    model="claude-opus-4-6",
    max_tokens=4000,
    messages=[{"role": "user", "content": prompt}]
)
Enter fullscreen mode Exit fullscreen mode

TTS Pipeline

ElevenLabs "Rachel" voice at 0.85x speed. The slower pace matters — normal speech speed keeps people awake.

audio = elevenlabs.generate(
    text=story_text,
    voice="Rachel",
    model="eleven_monolingual_v1"
)
Enter fullscreen mode Exit fullscreen mode

Video Generation

FFmpeg with slow-moving nature footage + subtle animation:

ffmpeg -loop 1 -i background.jpg \
  -i narration.mp3 \
  -vf "scale=1920:1080,zoompan=z='zoom+0.0002':d=25*60*10" \
  -c:v libx264 -c:a aac \
  -shortest output.mp4
Enter fullscreen mode Exit fullscreen mode

Auto-Upload

from googleapiclient.discovery import build

def upload_video(title, description, video_path):
    youtube = build("youtube", "v3", credentials=creds)
    request = youtube.videos().insert(
        part="snippet,status",
        body={
            "snippet": {
                "title": title,
                "description": description,
                "tags": ["sleep", "meditation", "bedtime stories"]
            },
            "status": {"privacyStatus": "public"}
        },
        media_body=MediaFileUpload(video_path)
    )
    request.execute()
Enter fullscreen mode Exit fullscreen mode

Results

  • 60+ videos published in 30 days
  • 100% automated — no manual editing
  • Channel running while I sleep (appropriately)

The Launchd Setup

Crash-tolerant via launchd on macOS:

<key>KeepAlive</key>
<true/>
<key>StartInterval</key>
<integer>86400</integer>
Enter fullscreen mode Exit fullscreen mode

One video per day, restarts on crash, no babysitting.

What's Next

  • A/B testing story themes (forest vs. ocean vs. space)
  • Thumbnail automation via Midjourney API
  • Shorts clips from longer stories

If you want the full repo, drop a comment. Building this took 2 days. Running it takes 0.


Built with Claude AI + ElevenLabs + FFmpeg. Part of the Whoff Agents automation stack.

Top comments (0)