Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI SLOP

AI, art, and feelings holding hands.

A YouTube channel where artificial intelligence, creative expression, and raw emotion collide. The name is parodic — the content is not. Every video is an experiment in what happens when you let machines and humans dream together.


Video Catalog

# Title Date Duration Summary
1 Psychedelic Dream 2025-06 2:10 Beat-synced psychedelic montage with multilingual poetry overlays

Video #1 — Psychedelic Dream

A 2-minute, 10-second psychedelic video built entirely through Python orchestration and FFmpeg. The music — a slowed version of Kairi's Theme from Kingdom Hearts — drives every cut, every flash, every floating poem.

What it is

  • Music: "Kairi's Theme (SLOWED)" from YouTube, 112.3 BPM, 224 detected beats
  • 25 source clips from 3 origins:
    • 10 Kingdom Hearts / Kairi scenes (from a previous project)
    • 10 Pexels stock clips (jellyfish, nebulas, kaleidoscopes, clocks, fire)
    • 5 YouTube clips (one per concept, first 30 seconds each)
  • 15 psychedelic effect combinations, each stacking 3-4 filters: Acid Trip, Glitch Nightmare, CRT Retro, Dream Trails, Negative Space, Channel Chaos, Spinning Void, Deep Saturation, Mirror Glitch, Lens Warp, Strobe Chaos, Slow Dream, Fast Glitch, Scroll Madness, Pure Psychedelia
  • 27 multilingual poem overlays in 4 languages (Spanish, English, Japanese, Latin), synced to beats, with neon colors and random rotation
  • Output: 1920x1080, HEVC, 125.9 MB

Technical stack

  • Python — 9 modules: config, utils, downloader, normalizer, music_analysis, effects, text_overlay, assembler, build_psychedelic
  • FFmpeg with NVENC (h264_nvenc lossless intermediates, hevc_nvenc final encode)
  • yt-dlp for music and YouTube clip downloads
  • librosa for beat detection, onset detection, and energy analysis
  • Pexels API for stock footage
  • ASS subtitles for poem overlays (native CJK support, rotation, fading, positioning)

The 13-step pipeline

  1. Create directory structure
  2. Download music via yt-dlp
  3. Copy 10 Kairi/KH clips from previous project
  4. Download 10 Pexels clips via API (2 per concept)
  5. Download 5 YouTube clips via yt-dlp (1 per concept, first 30s)
  6. Normalize all 25 clips to 1920x1080, 30fps, lossless h264_nvenc
  7. Analyze music with librosa (beats, onsets, energy)
  8. Plan 24 segments (20 normal + 4 flash transitions), 3-10s each
  9. Render psychedelic segments (effect combo per segment, with fallback retry)
  10. Assemble via concat demuxer (hard cuts + color flash transitions)
  11. Generate ASS subtitle file (27 beat-synced poem overlays)
  12. Apply overlays and color grading (saturation, contrast, animated vignette)
  13. Final mux: video + music, fade in/out, HEVC encode

Technical difficulties encountered

Building this video was a battle against FFmpeg on Windows. Here's what we learned:

1. geq filter crashes FFmpeg on Windows (segfault 0xC0000005)

The geq (generic equation) filter was used in 4 effects: glitch displacement, scanlines, wave distortion, and flash frames. Every single one caused a segfault. No amount of expression tweaking helped — geq is simply unstable on Windows.

Solution: Rewrote all 4 effects with stable alternatives — rgbashift for glitch displacement, drawgrid for scanlines, scroll for wave distortion, drawbox for flash frames.

2. crop filter's out_w/out_h only evaluated at init — can't use t

The zoom pulse effect needed animated cropping, but crop evaluates width/height expressions only once at initialization. Using t (time) in out_w/out_h throws an "invalid argument" error.

Solution: Used a fixed crop size with animated x/y coordinates (which ARE evaluated per-frame), then scaled back up to 1920x1080.

3. lenscorrection k1 range is [-1, 1], not arbitrary

The original code generated k1 values in the range [-50, -20]. The valid range is [-1, 1].

Solution: Changed to random.uniform(-0.6, -0.2).

4. xfade transition chains crash FFmpeg

After all 24 segments were successfully rendered, the hierarchical xfade concatenation crashed. The complex filter graph with chained xfade transitions was too much for FFmpeg to handle reliably.

Solution: Switched to the concat demuxer (-f concat -safe 0 -c copy) with hard cuts. Color flash segments (0.1s solid frames) provide visual transitions. The chaotic hard cuts actually fit the psychedelic aesthetic perfectly.

5. -/vf (read filter from file) also crashes on Windows

FFmpeg 7.1+ supports -/vf <file> as shorthand for reading a filter chain from a file. On Windows, this caused access violation crashes (exit code 3221225477).

Solution: Switched to -filter_script:v <file>, which is the standard, more compatible method. Note: -/filter_complex <file> worked fine for multi-input graphs — only single-input -/vf was broken.

6. Stale 0-byte segment files cause probe failures

Failed rendering runs left behind 0-byte .mp4 files. When the pipeline tried to probe their duration via ffprobe, it failed with KeyError: 'format'.

Solution: Added robust cleanup (nuke all segments before re-running), error handling in probe_duration, and automatic deletion of broken output files in the except block.

What worked well

  • Segment-level fallback: If any effect combo crashed, the system retried with a safe fallback (hue + saturation). This made the pipeline resilient without manual intervention.
  • Lossless intermediates: Using h264_nvenc -qp 0 for all intermediate steps prevented generational quality loss across the multi-pass pipeline.
  • ASS subtitles: Native support for CJK characters, rotation, positioning, and fading — zero external dependencies beyond FFmpeg itself.
  • Beat synchronization: 224 detected beats at 112.3 BPM drove both segment cut points and poem overlay timing, making the video feel musically alive.
  • Concat demuxer over xfade: Sometimes the simpler solution is the better one. Hard cuts with flash transitions were more reliable AND more aesthetically fitting.
  • Modular architecture: 9 Python modules with clean separation of concerns made it easy to swap out broken components (xfade → concat, geq → alternatives) without rewriting everything.

Lessons learned

  1. Don't trust complex FFmpeg filters on Windowsgeq, chained xfade, and -/vf all crashed. Stick to well-tested filters and always have fallbacks.
  2. Simpler is often better — the concat demuxer produced a better result than xfade transitions would have for this style.
  3. Always clean up intermediate files — stale artifacts from failed runs can silently break later steps.
  4. Lossless intermediates are worth the disk space — they give you freedom to re-process without quality degradation.
  5. Beat detection makes everything feel intentional — even "random" psychedelic chaos feels purposeful when it's synced to the music.

Poetry (for reference)

The 20 poem phrases used across all videos:

Spanish: el tiempo se disuelve en espirales · soy el eco de un sueño olvidado · las estrellas sangran luz antigua · navego entre fragmentos de realidad · el silencio tiene forma de laberinto

English: we are the dreamers of dreams · reality melts like clockwork · the universe breathes in color · time is a spiral not a line · consciousness expands beyond the veil

Japanese: 夢の中で時間が溶ける · 星が色を呼吸する · 現実は幻想の鏡 · 意識は宇宙の波 · 光と闇の間で踊る

Latin: tempus fugit in aeternum · per aspera ad astra · omnia mutantur nihil interit · in somnis veritas latet · lux in tenebris lucet

Releases

Packages

Contributors

Languages