mcpField
V
video-audio-extractor

video-audio-extractor

github.com/kantyleeCreative & media064 installsUpdated 38w ago
Repository

About video-audio-extractor

A command-line skill for extracting audio from local video files and direct video URLs, including YouTube with yt-dlp. It offers several output formats and controls for bitrate, sample rate, and output path.

Key features

  1. 01Extract audio from local video
  2. 02Process direct video URLs
  3. 03YouTube extraction via yt-dlp
  4. 04Choose format and audio quality
  5. 05Set output path and retain video

Use cases

  1. 01Creating MP3s from video files
  2. 02Saving YouTube audio as M4A
  3. 03Exporting lossless audio as FLAC

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/kantylee/video-audio-extractor --skill video-audio-extractor

After installing, type/video-audio-extractorin Claude Code to confirm it loaded.

Bundled filesREADME.mdscripts/extract-audio.py

Details

From the project README

Video Audio Extractor

Extract audio from video files or URLs. Supports various output formats including MP3, WAV, M4A, FLAC, OGG, and OPUS.

Features

  • ✅ Extract audio from local video files
  • ✅ Download and extract from direct video URLs
  • ✅ YouTube support - Direct audio extraction (requires yt-dlp)
  • ✅ Multiple output formats with quality control
  • ✅ Automatic cleanup of temporary files

Prerequisites

# Required
brew install ffmpeg

# Optional - for YouTube support
pip3 install yt-dlp

Quick Start

Extract from local file
{baseDir}/scripts/extract-audio.py video.mp4
# Creates: video.mp3
Extract from YouTube
{baseDir}/scripts/extract-audio.py "https://youtube.com/watch?v=..."
Different formats
{baseDir}/scripts/extract-audio.py video.mp4 -f wav    # WAV format
{baseDir}/scripts/extract-audio.py video.mp4 -f m4a    # Apple format
{baseDir}/scripts/extract-audio.py video.mp4 -f flac   # Lossless

Usage

extract-audio.py [-h] [-o OUTPUT] [-f {mp3,wav,m4a,aac,flac,ogg,opus}]
                 [-b BITRATE] [-r SAMPLE_RATE] [--keep-video] [--video-only]
                 input

Options

OptionDescriptionDefault
inputVideo file path or URL(required)
-o, --outputOutput audio file pathAuto-generated
-f, --formatOutput formatmp3
-b, --bitrateAudio bitrate192k
-r, --sample-rateSample rate (Hz)Original
--keep-videoKeep downloaded videoDelete after
--video-onlyDownload video without extractingDisabled

Supported Formats

FormatCodecNotes
MP3libmp3lameBest compatibility
WAVpcm_s16leUncompressed, large files
M4AAACApple ecosystem
FLACFLACLossless compression
OGGVorbisOpen format
OPUSOpusStreaming optimized

Examples

High quality MP3
{baseDir}/scripts/extract-audio.py video.mp4 -b 320k -r 48000
YouTube to M4A
{baseDir}/scripts/extract-audio.py "https://youtu.be/xxxxx" -f m4a
Custom output location
{baseDir}/scripts/extract-audio.py video.mp4 -o ~/Music/my-song.mp3
Download YouTube video (keep it)
{baseDir}/scripts/extract-audio.py "https://youtube.com/watch?v=..." --video-only --keep-video

YouTube Support

For YouTube videos, the tool uses yt-dlp to extract audio directly when possible. This is faster and more efficient than downloading the full video.

YouTube Limitations

YouTube actively blocks automated downloads. If you encounter errors:

  1. Update yt-dlp: pip3 install -U yt-dlp
  2. Try different URLs - Some videos have stricter restrictions
  3. Use --video-only to download the video first, then extract
  4. Browser extension - Use a YouTube downloader extension, then process the file
Common YouTube Errors
  • 403 Forbidden: YouTube blocked the request. Try updating yt-dlp or use a different video.
  • Sign in required: Video requires authentication. Use browser download instead.
  • Timeout: Video too large or connection slow. Try --video-only first.

Technical Details

  • Uses ffmpeg for audio extraction
  • Uses yt-dlp for YouTube downloads
  • Downloads to temporary directory, auto-cleanup by default
  • Preserves original audio codec when possible
  • Progress indicators for long operations

Comments

Markdown supported