flacconv/README.md

71 lines
3.3 KiB
Markdown
Raw Permalink Normal View History

2022-09-22 12:55:49 -05:00
# flacconv
flacconv is a 100% POSIX and (hopefully) portable[^1] shell script that recursively converts directories of flac files to opus/mp3.
2022-09-22 13:26:32 -05:00
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
2022-09-22 13:26:32 -05:00
it also has options for you to change the bitrate, use a variable quality for mp3, keep/remove metadata, and parallel processing
## dependencies
2022-09-25 10:18:53 -05:00
- Some implementation of a shell and [POSIX Utilities](https://pubs.opengroup.org/onlinepubs/9699919799/idx/utilities.html) (usually, this is GNU coreutils, which you probably have)
2023-04-12 11:41:47 -05:00
- `mktemp -u` (again, probably have this already)
- `flac` and `metaflac` (usually bundled together)
2023-04-12 11:41:47 -05:00
- `lame` (only if encoding to mp3)
- `opus-tools` (only if encoding to opus)
- [`opustags`](https://github.com/fmang/opustags) (optional, to use the -e option)
2022-09-25 10:18:53 -05:00
- `curl` (optional, for checking for updates)
2022-09-22 13:26:32 -05:00
## usage
```
usage: flacconv [-huvVipe3] [-b BITRATE] [-l LEVEL] [-k KEYS] [-r KEYS] [-j THREADS] [--] <DIRECTORY...>
2023-04-12 11:41:47 -05:00
flacconv recursively converts directories of flac files to opus/mp3
DIRECTORY can be specified multiple times
2024-02-02 11:40:13 -06:00
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
2022-10-10 21:52:42 -05:00
(blame id3. just use opus)
2022-09-22 13:26:32 -05:00
-h show script help
2022-09-25 10:18:53 -05:00
-u check for updates
2024-02-02 11:40:13 -06:00
-v verbose output (messy with multithreading)
-V very verbose output (VERY messy, use only for debugging and with like, -j 1)
2022-09-22 13:26:32 -05:00
-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
2022-10-10 21:52:42 -05:00
-l <LEVEL> mp3 only: use specified mp3 variable quality (0-9). integer only
2024-02-02 11:40:13 -06:00
OVERRIDES -b
2022-09-22 13:26:32 -05:00
-k <KEYS> keep specified flac metadata KEYS in output file
keys can be seen using metaflac --export-tags-to=- file.flac
2024-02-02 11:40:13 -06:00
argument is a comma or pipe-separated list of keys, case-insensitive
(i.e. -k "artist,title,albumartist,album,date")
2024-02-02 11:40:13 -06:00
if both -k and -r are not present, all keys are kept.
2022-09-22 13:26:32 -05:00
-r <KEYS> remove specified flac metadata KEYS in output file
option argument is of the same format as -k
2024-02-02 11:40:13 -06:00
if set to "ALL" (with capitalization), all keys are removed
2022-09-22 13:26:32 -05:00
-p remove embedded picture in output files
-e remove the "encoder" tag that automatically gets applied with opusenc
2023-04-12 11:41:47 -05:00
(requires opustags)
2022-09-22 13:26:32 -05:00
-j <THREADS> use the specified amount of threads for parallel processing
2022-12-24 17:30:58 -06:00
if omitted, CPU core count will be used
2022-09-22 13:26:32 -05:00
```
2022-09-22 15:49:07 -05:00
## examples
2023-04-12 11:41:47 -05:00
recursively convert a directory of flacs to opus 128k, removing the picture and ENCODER tags for every file
2022-09-22 15:49:07 -05:00
2023-04-12 11:41:47 -05:00
`flacconv -p -e /path/to/dir`
2022-09-22 15:49:07 -05:00
recursively convert the current directory to mp3 320k
`flacconv -b 320 -3 .`
2022-09-22 15:49:07 -05:00
recursively convert current directory to opus 160k, while removing any COMMENT or DESCRIPTION tags
`flacconv -b 160 -r comment,description .`
2022-09-22 15:49:07 -05:00
recursively convert current directory to mp3 v0, removing all pictures
2022-09-22 15:49:07 -05:00
`flacconv -3 -l 0 -p .`
2022-09-22 15:49:07 -05:00
2022-10-11 08:55:28 -05:00
[^1]: tested with dash, bash, and yash (set -o posixly-correct) on linux. further testing encouraged