|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +ffmpeg-normalize is a Python utility for audio normalization using ffmpeg. It supports EBU R128 loudness normalization, RMS-based normalization, and peak normalization for audio and video files. |
| 8 | + |
| 9 | +## Development Commands |
| 10 | + |
| 11 | +### Testing |
| 12 | +- `pytest` - Run all tests (requires installing requirements.dev.txt) |
| 13 | +- `python -m ffmpeg_normalize [args]` - Run the tool directly for testing |
| 14 | + |
| 15 | +### Code Quality |
| 16 | +- `ruff` - Linting and code formatting |
| 17 | +- `mypy` - Type checking |
| 18 | + |
| 19 | +### Installation |
| 20 | +- `pip install -r requirements.txt` - Install runtime dependencies |
| 21 | +- `pip install -r requirements.dev.txt` - Install development dependencies |
| 22 | + |
| 23 | +### Documentation |
| 24 | +- `pdoc -d google -o docs-api ./ffmpeg_normalize` - Generate API documentation |
| 25 | +- `uvx --with mkdocs-material mkdocs gh-deploy` - Deploy MKdocs documentation |
| 26 | + |
| 27 | +## Architecture |
| 28 | + |
| 29 | +### Core Components |
| 30 | + |
| 31 | +- **FFmpegNormalize** (`_ffmpeg_normalize.py`): Main class that orchestrates the normalization process |
| 32 | +- **MediaFile** (`_media_file.py`): Represents a media file with its streams and metadata |
| 33 | +- **Stream classes** (`_streams.py`): AudioStream, VideoStream, SubtitleStream, MediaStream for handling different stream types |
| 34 | +- **Command utilities** (`_cmd_utils.py`): FFmpeg command generation and execution helpers |
| 35 | +- **Error handling** (`_errors.py`): Custom exception classes |
| 36 | +- **Logger** (`_logger.py`): Logging configuration and utilities |
| 37 | + |
| 38 | +### Normalization Types |
| 39 | +The tool supports three normalization types defined in `NORMALIZATION_TYPES`: |
| 40 | +- `ebu`: EBU R128 loudness normalization (default) |
| 41 | +- `rms`: RMS-based normalization |
| 42 | +- `peak`: Peak normalization |
| 43 | + |
| 44 | +### Entry Point |
| 45 | +- Console script entry point: `ffmpeg-normalize = ffmpeg_normalize.__main__:main` |
| 46 | +- Module execution: `python -m ffmpeg_normalize` |
| 47 | + |
| 48 | +## Development Notes |
| 49 | + |
| 50 | +### Dependencies |
| 51 | +The project uses: |
| 52 | +- `tqdm` for progress bars |
| 53 | +- `ffmpeg-progress-yield` for FFmpeg progress monitoring |
| 54 | +- `colorlog` for colored logging |
| 55 | +- `mutagen` for metadata handling |
| 56 | +- `colorama` (Windows only) for colored terminal output |
| 57 | + |
| 58 | +### File Structure |
| 59 | +- `ffmpeg_normalize/` - Main package directory |
| 60 | +- `tests/` - Test files and test media samples |
| 61 | +- `docs/` - MKdocs documentation source |
| 62 | +- `completions/` - Shell completion scripts |
| 63 | + |
| 64 | +### Testing |
| 65 | +Tests use pytest and include actual media files in the `tests/` directory. The test suite calls the CLI directly using `python -m ffmpeg_normalize` to test the full pipeline. |
| 66 | + |
| 67 | +### Requirements |
| 68 | +- Python 3.9+ |
| 69 | +- FFmpeg binary must be available in PATH |
| 70 | +- The tool checks for FFmpeg loudnorm filter availability at runtime |
0 commit comments