A simple and efficient Python tool called ClipPy to extract audio from video files using FFmpeg.
- 🎵 Extract high-quality audio from various video formats
- 🔧 Supports multiple output formats (MP3, WAV)
- 📁 Automatic filename generation based on input video
- ✅ Comprehensive file validation and error handling
- 🖥️ Both CLI interface and Python library usage
- 🛠️ Modular architecture for easy maintenance
- MP4 (.mp4)
- MKV (.mkv)
- AVI (.avi)
- MOV (.mov)
- WMV (.wmv)
- FLV (.flv)
- WebM (.webm)
- M4V (.m4v)
- MPG/MPEG (.mpg, .mpeg)
- 3GP (.3gp)
- F4V (.f4v)
- Python 3.6+ installed on your system
- FFmpeg installed on your system
Ubuntu/Debian:
sudo apt update
sudo apt install ffmpegmacOS:
brew install ffmpegWindows: Download from ffmpeg.org and add to your PATH
pip install ffmpeg-pythonpython main.py -i <input_video> [-o <output_audio>] [-f <format>]# Extract audio to MP3 (default format)
python main.py -i video.mp4
# Specify output filename
python main.py -i video.mp4 -o audio.wav
# Specify output format
python main.py -i video.mkv -f mp3
# Full specification
python main.py -i input_video.avi -o output_audio.mp3 -f mp3-i, --input: Input video file path (required)-o, --output: Output audio file path (optional)-f, --format: Output format:mp3orwav(default:mp3)
from clippy import get_audio_from_video
# Basic usage
success = get_audio_from_video("video.mp4")
# With custom output path
success = get_audio_from_video("video.mp4", "audio.wav")
# Specify format
success = get_audio_from_video("video.mp4", audio_format="wav")video_to_audio/
├── main.py # Entry point for CLI usage
├── README.md # This file
└── clippy/ # Main package
├── __init__.py # Package exports
└── src/ # Source code
├── __init__.py
├── cli/ # Command line interface
│ └── interface.py # Argument parsing and validation
├── core/ # Core functionality
│ └── audio_extractor.py # Audio extraction logic
└── utils/ # Utility functions
└── validation.py # File and system validation
- Validation Phase: Checks if the input video exists and is a valid file
- FFmpeg Check: Ensures FFmpeg is installed and accessible
- Output Path Resolution: Generates output filename if not specified
- Audio Extraction: Uses FFmpeg to extract audio stream
- Result Reporting: Provides success/failure feedback
The tool provides clear error messages for common issues:
- Missing input file
- Unsupported file format
- Missing FFmpeg installation
- Permission errors
- Invalid output directory
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
Make sure FFmpeg is installed and added to your system PATH:
ffmpeg -version # Should display FFmpeg version infoEnsure you have write permissions in the output directory:
chmod +w /path/to/output/directoryWhile the tool warns about unsupported extensions, FFmpeg may still be able to process the file. The warning is precautionary.
- v1.0.0: Initial release with basic audio extraction functionality
ClipPy Team
Note: This tool requires FFmpeg to be installed on your system. Make sure to install it before using the converter.