Convert Flac to Apple '.m4a' files (alac, aac)
Project description
AudioTown is a lightweight audio file oriented package that intends to do two things:
- Explain this media folder to me.
- It converts the lossless files (
.flac) in your collection to more apple friendly format,.m4a. Supports both high-quality ALAC (Lossless) and AAC (Lossy) as codec. When it converts, it tries preserving metadata, including album artwork from source files.
What to expect
audiotowncontains three commands:check,statsandconvert. This package requiresffmepginstalled in the system.- To run them, type
auditown checkoraudio statsoraudio convert. - Type
audiotown checkto runcheck. - The command checks if
ffmpegis installed.
- To run them, type
statsacts as an executive assisant for audio media management. Personal media library are often messy. This command starts by searching thefolderrecursively and laser focus ONLY on audio files (filtered by suffix). It then prints out to the terminal a summary report about how it finds:- numbers of songs by formats, by encoding types,
- storage usage details,
- what top artists, genre, album are to me ,
- are they lossless or lossy, and
- detect potential unreadable or corrupt files.
statscan export scanned records into a JSON file via--report-pathflag.convert. It converts all.flacfiles in a folder into lossless (alac) or lossy (aac) versions. a apple lossless encoded.m4afile can be recognized in Apple eco system but not usually for.flacfiles.--report-pathis available inconverttoo. To run itaudiocheck convert /path/to/flacs --encoder=alac --report-path=.. The converted will be exported to a new folderaudiotown_exportin the same folderpath/to/flacs.convertalso support--dry-runas a tool to preview changes made in a conversion.convertsearch files recursively so I can specify a high-levelfolderlikeMediaormyMediaHub. Try with one ablum folder first.convertssupport--bitratewhen the--encoder=aacis specified. the default bitrate kbps is256k.128kand320kare the other valid inputs.converthas a babit that searchscover.jpgorlibrary.jpgin the existing folder strucutre. if the source file does not contain an artwork, the command attempts to find such file and add it into output files whenever possible.
Installation
- Ensure I have FFmpeg installed on the system. It is the powerhouse that does the conversion and other heavy work like probing
ffprobe. I will need it installed and working. Mac users can installed it via homebrew:brew install ffmpeg. - Python >3.10+.
- Requires
clickandwcwidthlibaries.
# [optional but recommended] set up a virutal env named `my_env`.
python3 -m venv my_env
source my_env/bin/activate
# check python version 3.10+
python --version
# udpate pip
pip install --upgrade pip
pip install audiotown
# help
audiotown
🛠 Usage
audiotown [OPTIONS] COMMAND [ARGS]...
Options:
-h, --help Show this message and exit.
Commands:
check Verify that FFmpeg and dependencies are correctly installed.
convert Convert FLACs in FOLDER to Apple-friendly formats.
stats Stats Dashboard & Insight tool.
Examples
- The simplest way to use
AudioTownis to run it in a folder containing FLAC files:audiotown convert /path/to/album/folder --codec=alac --report-path=/path/to/report/folder --dry-run. The file search is resursive. - the output files from
audio convertare under the subfolderaudiotown_converted/within/path/to/album/folder. - The
/path/to/report/foldercan be.or any specified directories. - use
--dry-runto preview any perceived changes. - The
converttakes onlyflacfiles. It supports:flac --> alacorflac --> aac
# 1. show additional help
audiotown
audiotown -h
audiotown --help
# 2. check ffmpeg installation
audiotown check
# 3. show stats of a media folder
cd /path/to/media/folder
audiotown stats .
# alternatively
audiotown stats /path/to/media/folder
audiotown stats /path/to/media/folder --report-path=.
# 4. convert all flac files to alac (default) or aac based formats. logging is controlled by `--report-path`
# . means current directory
audiotown convert . --report-path=.
audiotown convert . --codec=alac --report-path=. --dry-run
audiotown convert . --codec=aac --bitrate=256k --report-path=. --dry-run
Advanced Options
- overview
| Option | Description | Default |
|---|---|---|
--codec |
alac or aac. used with convert. |
alac |
--bitrate |
Bitrate for AAC (128k, 256k, 320k). only useful when --codec=aac |
256k |
--dry-run |
Preview conversion without writing files. used with convert |
False |
--report-path |
generates a full log, including a json. work with both convert and stats. |
disabled |
-
Examples
- Run a preview to see what would be converted:
audiotown convert ./AlbumFolder --dry-run
- use
codecand--bitrate. It means the desired codec used for the output.
audiotown convert . --codec=alac audiotown convert . --codec=aac --bitrate=256k audiotown convert . --codec=aac --bitrate=128k
- It does not make sense to specify
bitratefor losslessalacsobitratewill be ignored.
cd /my/media/folder audiotown convert . --codec=alac --bitrate=128k
LICENSE
Licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
audiotown-1.0.9.tar.gz
(26.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
audiotown-1.0.9-py3-none-any.whl
(25.5 kB
view details)
File details
Details for the file audiotown-1.0.9.tar.gz.
File metadata
- Download URL: audiotown-1.0.9.tar.gz
- Upload date:
- Size: 26.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
92e36a642523d6c6148a102c2fa2be97dd7ed2100b74356e04031db412fcbf04
|
|
| MD5 |
2c96fd5e2ca3421ff59d83ae1d5e9b36
|
|
| BLAKE2b-256 |
06efc983ac238c0eba7e7b6ed162c85bf6524f6ae07453ea5eccacf03e73a0fb
|
File details
Details for the file audiotown-1.0.9-py3-none-any.whl.
File metadata
- Download URL: audiotown-1.0.9-py3-none-any.whl
- Upload date:
- Size: 25.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3cc5cdbd799bf11b60094d0d4820681864d23937fabf060d94517dd4faa91d89
|
|
| MD5 |
0cc216629c11bb00724ecfe4aa18ceef
|
|
| BLAKE2b-256 |
70faddd7f45e3926605fccea958178250240c8fcb0366db843d0d2c26f879879
|