yosh 1253d60e45 | ||
---|---|---|
CHANGELOG.md | ||
README.md | ||
flacconv |
README.md
flacconv
flacconv is a 100% POSIX and (hopefully) portable1 shell script that recursively converts directories of flac files to opus/mp3.
with no flags, it recursively converts flac files in the specified directory (or directories) to opus with a bitrate of 128k, retaining all metadata and not deleting the original flac files
it also has options for you to change the bitrate, use a variable quality for mp3, keep/remove metadata, and parallel processing
dependencies
- Some implementation of a shell and POSIX Utilities (usually, this is GNU coreutils, which you probably have)
mktemp -u
(again, probably have this already)flac
andmetaflac
(usually bundled together)lame
(only if encoding to mp3)opus-tools
(only if encoding to opus)opustags
(optional, to use the -e option)curl
(optional, for checking for updates)
usage
usage: flacconv [-huvVipe3] [-b BITRATE] [-l LEVEL] [-k KEYS] [-r KEYS] [-j THREADS] [--] <DIRECTORY...>
flacconv recursively converts directories of flac files to opus/mp3
DIRECTORY can be specified multiple times
IF ENCODING TO MP3, -k AND -r WILL NOT WORK. the only metadata that will be kept is the following:
TITLE, ARTIST, ALBUM, ALBUMARTIST, DATE, GENRE, TRACKNUMBER, COMMENT, and the cover picture
(blame id3. just use opus)
-h show script help
-u check for updates
-v verbose output (messy with multithreading)
-V very verbose output (VERY messy, use only for debugging and with like, -j 1)
-i ignore script-stopping warnings
-d delete original flac files after transcoding
-3 switch output filetype to mp3
-b <BITRATE> output bitrate in kbits (default 128)
this value is variable for opus & CBR for mp3
-l <LEVEL> mp3 only: use specified mp3 variable quality (0-9). integer only
OVERRIDES -b
-k <KEYS> keep specified flac metadata KEYS in output file
keys can be seen using metaflac --export-tags-to=- file.flac
argument is a comma or pipe-separated list of keys, case-insensitive
(i.e. -k "artist,title,albumartist,album,date")
if both -k and -r are not present, all keys are kept.
-r <KEYS> remove specified flac metadata KEYS in output file
option argument is of the same format as -k
if set to "ALL" (with capitalization), all keys are removed
-p remove embedded picture in output files
-e remove the "encoder" tag that automatically gets applied with opusenc
(requires opustags)
-j <THREADS> use the specified amount of threads for parallel processing
if omitted, CPU core count will be used
examples
recursively convert a directory of flacs to opus 128k, removing the picture and ENCODER tags for every file
flacconv -p -e /path/to/dir
recursively convert the current directory to mp3 320k
flacconv -b 320 -3 .
recursively convert current directory to opus 160k, while removing any COMMENT or DESCRIPTION tags
flacconv -b 160 -r comment,description .
recursively convert current directory to mp3 v0, removing all pictures
flacconv -3 -l 0 -p .
-
tested with dash, bash, and yash (set -o posixly-correct) on linux. further testing encouraged ↩︎