Skip to content

Commit 13a65d5

Browse files
committed
add initial API-based ground truth tests
... with Claude Code
1 parent 30c2a48 commit 13a65d5

4 files changed

Lines changed: 457 additions & 0 deletions

File tree

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,7 @@ normalized
5656

5757
# mkdocs
5858
site/
59+
60+
# Test files downloaded during testing
61+
tests/mus-sample/
62+
tests/mus-sample.zip

CLAUDE.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
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

pytest.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[pytest]
2+
markers =
3+
slow: marks tests as slow (deselect with '-m "not slow"')

0 commit comments

Comments
 (0)