Files
test/recipe-bound copy.sexp
gilesb 406cc7c0c7 Initial commit: video effects processing system
Add S-expression based video effects pipeline with modular effect
definitions, constructs, and recipe files.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 12:34:45 +00:00

46 lines
1.9 KiB
Common Lisp

; Beat-synced video with full lambda control
(recipe "bound-effects"
:version "1.0"
:encoding (:codec "libx264" :crf 22 :preset "fast" :audio-codec "aac" :fps 30)
(analyzer beats :path "../artdag-analyzers/beats/analyzer.py")
(analyzer bass :path "../artdag-analyzers/bass/analyzer.py")
(effect invert :path "../artdag-effects/invert/effect.py")
(effect sepia :path "sexp_effects/effects/sepia.sexp")
(construct slice-on :path "constructs/slice-on.sexp")
(def video-a (source :path "monday.webm" :description "Video A"))
(def video-b (source :path "new.webm" :description "Video B"))
(def video-c (source :path "ecstacy.mp4" :description "Video c"))
(def audio (-> (source :path "dizzy.mp3" :description "Audio input")
(segment :start 0 :duration 10)))
(def beats-data (-> audio (analyze beats)))
(def bass-data (-> audio (analyze bass)))
; Alternate sources and bind invert intensity to bass
; slice-on produces a list of segments, then we explicitly concat with normalization
; video-b always gets sepia effect applied
(def segments (slice-on beats-data
:init 0
:reducer (fn [acc i start end]
(let [idx (mod acc 3)
src (nth (list video-a video-b video-c) idx)
base-effects (list {:effect invert :intensity (bind bass-data :range [0 100])})
effects (if (= idx 1)
(concat base-effects (list {:effect sepia}))
base-effects)]
{:source src
:effects effects
:acc (inc acc)}))))
; Concatenate with resize normalization (fit to width, pad height)
(def synced-video (-> segments
(sequence :resize-mode :fit :priority :width)))
(mux synced-video audio))