Terminal.skills
Use Cases/Produce Video Content with Programmatic Editing and Waveform Visualization

Produce Video Content with Programmatic Editing and Waveform Visualization

Automate video editing with MoviePy, generate audio waveform visuals with audiowaveform, and produce polished video content without manual editing software.

Content#moviepy#python#video-editing#compositing#automation
Works with:claude-codeopenai-codexgemini-clicursor
$

The Problem

A podcast network produces 8 weekly shows, each needing a video version for YouTube with audio waveform animations, branded intro and outro sequences, speaker name lower thirds, and chapter title cards. A video editor manually creates each episode in Premiere Pro, spending 2-3 hours per episode: importing the audio, adding the waveform animation plugin, timing the lower thirds, rendering, and exporting for YouTube's recommended settings. At 8 episodes per week, video production consumes 20 hours -- more than the actual recording time. The shows follow identical templates, yet every episode is hand-built from scratch. The video editor is spending 90% of their time on mechanical, repeatable work rather than creative production.

The Solution

Use MoviePy for programmatic video composition (overlaying elements, trimming, concatenating clips), audiowaveform to generate animated waveform data from audio files, and ffmpeg-video-editing for final rendering and format optimization. A Python script takes a raw audio file and metadata, then outputs a complete YouTube-ready video in minutes.

Step-by-Step Walkthrough

1. Generate waveform visualization data from audio

Extract waveform data from the podcast audio to create the animated visualization that will be the centerpiece of the video. The waveform is generated from the actual audio samples, not approximated from volume levels, so it accurately represents the recording.

Generate waveform data from our podcast episode audio file (episode-142.wav, 58 minutes, stereo). Use audiowaveform to produce a JSON waveform data file at 10 pixels per second resolution for smooth animation. Also generate a static PNG waveform overview at 1920x200 pixels for the episode thumbnail. Output in both JSON format for the animated video and binary format for fast rendering.

The JSON waveform data is lightweight -- typically under 500 KB for a full hour of audio -- making it fast to load and render in the video composition step.

2. Build the video composition with MoviePy

Assemble the video programmatically -- background, animated waveform, speaker names, and chapter titles -- from a template and episode metadata.

Create a MoviePy script that builds a podcast video from these inputs: the audio file (episode-142.wav), the audiowaveform JSON data, our branded background image (1920x1080), and an episode metadata JSON with speaker names, chapter timestamps, and episode title. The script should render an animated waveform centered on screen that moves in sync with the audio, display speaker name lower thirds that appear and fade at timestamps specified in the metadata, and show chapter title cards at each chapter transition.

3. Add branded intro and outro sequences

Prepend and append the show's standard intro and outro clips, with a crossfade transition from the intro into the main content. The intro and outro are pre-rendered video files so they maintain their original quality and animation effects.

Extend the MoviePy script to prepend our 8-second branded intro video (intro-template.mp4) with a 1-second crossfade into the main episode. Append our 12-second outro video (outro-template.mp4) with the episode number and next episode date rendered as text overlays. The outro should include a 5-second end screen area compatible with YouTube end screen elements at 1280x720 in the bottom right.

The end screen area is left as a clean section so YouTube's end screen editor can overlay subscribe buttons and related video cards without competing with the outro graphics.

4. Optimize rendering with ffmpeg

Use ffmpeg to render the final video with YouTube-optimized encoding settings that balance quality and upload speed. The encoding settings matter: YouTube re-encodes every upload, so starting with high-quality source material produces better results after YouTube's compression.

Render the composed video using ffmpeg with these settings: H.264 at CRF 18 for high quality, the slow preset for good compression, AAC audio at 192 kbps, faststart flag for web playback, and the bt709 color space for accurate YouTube colors. Target a final file size under 2 GB for the 58-minute episode. Also generate a 30-second preview clip from the most dynamic section of the waveform for social media promotion, cropped to 1080x1080 for Instagram.

5. Batch process the weekly episode queue

Wrap the pipeline in a batch processor that handles all 8 weekly episodes from a single command.

Create a batch processing script that reads a weekly manifest JSON listing all 8 episodes with their audio paths, metadata, and show-specific branding assets. Process each episode through the full pipeline: waveform generation, video composition, intro/outro assembly, and final render. Run episodes in parallel on available CPU cores. Output a summary report with render times, file sizes, and any errors. Deposit finished files in an uploads directory organized by show name and episode number.

Real-World Example

The podcast network's engineering lead built the pipeline over a weekend and ran it against the week's 8 episodes on a Monday morning. Waveform generation for all 8 episodes completed in 12 minutes. MoviePy composed the videos in parallel across 8 CPU cores, taking 35 minutes total. The ffmpeg rendering pass added another 45 minutes with the slow preset for optimal file sizes.

By lunchtime, all 8 YouTube-ready videos sat in the uploads folder -- a process that previously consumed 20 hours of a video editor's week. The waveform animations looked cleaner than the old plugin-based approach because audiowaveform produced precise sample-level data rather than an approximated visual effect. Each episode's video file was under 1.5 GB for an hour of content, well within YouTube's recommended upload specs.

The video editor shifted to creating custom promotional clips and highlight reels -- creative work that actually needed human judgment -- while the template-based weekly episodes ran on autopilot. The 30-second Instagram preview clips, automatically extracted from the most dynamic waveform sections, became a reliable audience driver: two shows saw a 15% increase in YouTube views from followers who discovered episodes through the Instagram previews.