The Challenge: GIFs Aren’t YouTube-Ready

While working on Aditi’s documentation, we’ve been using Charmbracelet VHS to create beautiful terminal demonstrations. VHS is fantastic for generating animated GIFs that showcase CLI workflows, but there’s one catch: YouTube doesn’t accept GIF uploads.

This presented a problem when we wanted to share our terminal demos on YouTube for broader reach and better discoverability.

The Solution: Automated GIF-to-MP4 Conversion

Rather than manually converting each demo, we built an automated conversion script that transforms all VHS-generated GIFs into YouTube-optimized MP4 videos.

Key Features

Our convert-to-youtube.sh script includes:

  • YouTube-optimized encoding: H.264 codec with YUV420P pixel format
  • High-quality output: CRF 18 setting for excellent visual quality
  • Web-optimized: Fast-start enabled for immediate streaming
  • Batch processing: Converts all GIFs automatically
  • Progress tracking: Colored output with file size comparisons
  • Flexible: Custom output directories and comprehensive help

Technical Implementation

The script uses ffmpeg with carefully chosen parameters:

ffmpeg -i input.gif \
    -movflags faststart \
    -pix_fmt yuv420p \
    -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" \
    -r 30 \
    -c:v libx264 \
    -crf 18 \
    -preset slow \
    -y output.mp4

Why these settings?

  • movflags faststart: Enables immediate playback without full download
  • pix_fmt yuv420p: Maximum compatibility across players and platforms
  • scale filter: Ensures even dimensions (required by some codecs)
  • r 30: 30fps frame rate (YouTube’s sweet spot for screen recordings)
  • crf 18: High quality with reasonable file sizes
  • preset slow: Better compression efficiency

Usage Examples

# Convert all GIFs in vhs-cassettes directory
./convert-to-youtube.sh

# Use custom output location
./convert-to-youtube.sh -o /path/to/youtube-videos

# Get help and options
./convert-to-youtube.sh --help

Real-World Impact

This automation solves several pain points:

  1. Consistency: Every video uses the same high-quality settings
  2. Efficiency: Batch conversion saves time as we create more demos
  3. Quality: Optimized settings ensure crisp playback on YouTube
  4. Maintainability: Script handles edge cases and provides clear feedback

Integration with VHS Workflow

The script integrates seamlessly into our existing VHS workflow:

# Create terminal demo
vhs demo-journey.tape          # Generates demo-journey.gif

# Convert for YouTube
./convert-to-youtube.sh        # Creates demo-journey.mp4

# Upload to YouTube with optimal quality

File Organization

The script creates a clean separation:

vhs-cassettes/
├── demo-01-getting-started.gif    # Original VHS output
├── demo-01-getting-started.tape   # VHS script
├── convert-to-youtube.sh           # Conversion script
└── youtube-ready/
    └── demo-01-getting-started.mp4 # YouTube-ready video

Why This Matters for Documentation

High-quality video demonstrations are crucial for:

  • User onboarding: Visual guides reduce learning curves
  • Feature showcases: Complex CLI workflows become accessible
  • Community engagement: YouTube’s reach extends beyond technical documentation
  • SEO benefits: Video content improves search discoverability

Looking Forward

This script is part of Aditi’s broader commitment to comprehensive documentation tooling. By automating the conversion process, we can focus on creating great content rather than wrestling with video formats.

The next step is integrating this into our CI/CD pipeline, automatically generating YouTube-ready videos whenever we update our VHS demonstrations.


The conversion script is available in the vhs-cassettes/ directory and represents another step toward making Aditi’s documentation as polished and accessible as the tool itself.


Copyright © 2025 Aditi. Distributed under the MIT License.