Home
cd ../playbooks
ProductivityBeginner

Video Downloader

Download YouTube videos with customizable quality and format settings, including audio extraction to MP3.

5 minutes
By ComposioSource
#youtube#video#download#mp3#audio#media
CLAUDE.md Template

Download this file and place it in your project folder to get started.

# Video Downloader

Download YouTube videos with customizable quality and format settings, including audio extraction.

## Basic Usage

```bash
python scripts/download_video.py "https://www.youtube.com/watch?v=VIDEO_ID"
```

## Options

### Quality (-q)
- `best` - Highest available quality (default)
- `1080p` - Full HD
- `720p` - HD
- `480p` - Standard definition
- `360p` - Low quality

### Format (-f)
- `mp4` - Most compatible format (default)
- `webm` - Web-optimized format
- `mkv` - High quality container

### Audio Only (-a)
Extract audio as MP3:
```bash
python scripts/download_video.py "URL" -a
```

### Output Location (-o)
Specify download location:
```bash
python scripts/download_video.py "URL" -o /path/to/folder
```

## Examples

### Download Best Quality
```bash
python scripts/download_video.py "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
```

### Download 720p in WebM
```bash
python scripts/download_video.py "URL" -q 720p -f webm
```

### Extract Audio Only
```bash
python scripts/download_video.py "URL" -a
```

### Custom Output Path
```bash
python scripts/download_video.py "URL" -o ~/Videos/Downloads
```

### Combined Options
```bash
python scripts/download_video.py "URL" -q 1080p -f mp4 -o ~/Videos
```

## Technical Details

### Underlying Technology
- Uses yt-dlp for downloading
- Auto-installs if not present
- Handles stream merging automatically

### File Naming
- Generates filenames from video titles
- Sanitizes special characters
- Adds appropriate extension

### Default Output
Files save to `/mnt/user-data/outputs/` unless specified otherwise.

## Workflow

When user requests a video download:

1. **Parse the URL**: Extract video ID
2. **Check options**: Quality, format, audio-only
3. **Run download**: Execute with appropriate flags
4. **Report result**: Confirm file location and size

## Quality Considerations

| Quality | Typical Size (10min) | Download Time |
|---------|---------------------|---------------|
| 1080p | 500MB - 1GB | Longer |
| 720p | 200-400MB | Moderate |
| 480p | 100-200MB | Faster |
| 360p | 50-100MB | Fastest |
| Audio | 10-20MB | Very fast |

## Notes

- Higher resolutions require more time and storage
- Not all videos have all quality options
- Some videos may be restricted
- Respects video availability in your region

## Error Handling

If download fails:
- Check URL is valid
- Verify video is public
- Try lower quality
- Check network connection
README.md

What This Does

Download YouTube videos with customizable quality and format settings. Choose resolution (1080p, 720p, etc.), format (MP4, WebM), or extract audio only as MP3.


Quick Start

Step 1: Download the Template

Click Download above and place in any folder:

mv ~/Downloads/CLAUDE.md ~/Documents/

Step 2: Start Claude

cd ~/Documents
claude

Step 3: Download a Video

"Download this YouTube video: [URL]"


Quality Options

Quality Resolution Best For
best Highest available Archiving
1080p Full HD Most uses
720p HD Good balance
480p SD Smaller files
360p Low Minimal storage

Format Options

Format Extension Notes
MP4 .mp4 Most compatible
WebM .webm Web-optimized
MKV .mkv High quality container
MP3 .mp3 Audio only

Example Commands

Download in Best Quality

Download this YouTube video in best quality: [URL]

Specific Resolution

Download this video in 720p: [URL]

Audio Only

Extract the audio from this video as MP3: [URL]

Custom Location

Download this video to my Videos folder: [URL]

Notes

  • Auto-installs dependencies: yt-dlp installs automatically if needed
  • Stream merging: Handled automatically for best quality
  • File naming: Uses video title automatically
  • Higher resolution = longer download: 1080p takes more time and space

Tips

  • Check available quality: Not all videos have 1080p
  • Use MP3 for podcasts: Smaller files, audio only
  • Batch downloads: Multiple URLs work sequentially
  • Storage space: 1080p videos can be 1-2GB+

$Related Playbooks