This tool analyzes audio files for quality metrics such as bit rate, frequency, and codec type in bulk. It also generates spectrograms for visual representation of the audio spectrum. It supports a variety of audio formats, including MP3, FLAC, WAV, AAC, M4A, and more.
- Analyze audio files for detailed quality metrics.
- Generate spectrograms for audio visualization.
- Supports multiple file types:
mp3
,flac
,wav
,aac
,ogg
,m4a
,aiff
. - Batch processing of files in a directory.
- Recursive directory scanning.
- Multi-threaded processing for faster analysis.
- Export results in HTML or CSV format.
- Python 3.7 or later
- FFmpeg (for metadata extraction and file decoding)
- Required Python libraries (see
requirements.txt
)
-
Clone the repository:
git clone https://github.com/oren-cohen/whatsmybitrate.git cd whatsmybitrate
-
Install Python dependencies:
pip install -r requirements.txt
-
Install FFmpeg:
- Linux:
sudo apt update sudo apt install ffmpeg
- MacOS:
brew install ffmpeg
- Windows:
- Download FFmpeg from ffmpeg.org.
- Extract the archive and add the
bin
folder to your system's PATH.
To verify FFmpeg installation, run:
ffmpeg -version
- Linux:
Analyze all audio files in the current directory and generate a report:
python whatsmybitrate.py -f report.html -l -a # For HTML report
python whatsmybitrate.py -f report.csv -l -a # For CSV report
Argument | Description |
---|---|
-f <file> |
Output report file name (required). Use .html or .csv extension for desired format. |
-l |
Enable logging. |
-a |
Analyze all supported audio types. |
-t <type> |
Analyze a specific file type (e.g., mp3 , wav ). |
-r |
Scan directories recursively. |
-m <threads> |
Number of threads to use for analysis (default: 1). |
-n |
Disable spectrogram generation (spectrograms are generated by default). |
<input> |
Specify individual files or patterns (e.g., *.mp3 , *.wav ). |
-
Analyze all files in a directory recursively:
python whatsmybitrate.py -f analysis.html -l -a -r /path/to/directory # HTML report python whatsmybitrate.py -f analysis.csv -l -a -r /path/to/directory # CSV report
-
Analyze only
mp3
files in a directory recursively:python whatsmybitrate.py -f mp3_analysis.html -t mp3 -r /path/to/directory # HTML report python whatsmybitrate.py -f mp3_analysis.csv -t mp3 -r /path/to/directory # CSV report
-
Analyze specific files:
python whatsmybitrate.py -f specific_files.html file1.mp3 file2.wav # HTML report python whatsmybitrate.py -f specific_files.csv file1.mp3 file2.wav # CSV report
- WAV
- FLAC
- MP3
- AAC
- OGG
- M4A
- AIFF
The script can generate reports in two formats:
-
HTML Report (use
.html
extension): Contains detailed metrics for each file, including:- Codec
- Sample Rate
- Max Frequency
- Nyquist Frequency
- Frequency Ratio
- Stated Bit Rate
- Estimated Bitrate
- Spectrogram image (if generated)
-
CSV Report (use
.csv
extension): Contains the same metrics in a tabular format suitable for:- Importing into spreadsheet software
- Data analysis and processing
- Integration with other tools
Note: CSV reports exclude spectrograms as they cannot be represented in CSV format.
Ensure FFmpeg is installed and added to your system's PATH. Test the installation by running:
ffmpeg -version
If spectrograms are missing:
- Ensure
matplotlib
andlibrosa
are installed:pip install matplotlib librosa
- Check that the audio file is not corrupt or unsupported.
If the script encounters errors, enable logging with the -l
flag. Review the logs for detailed error messages.
This project is not licensed. Do you want you want with it. :)
If you encounter any issues, feel free to open an issue on the GitHub repository.