Skip to main content

Recursively mirror a directory tree of FLAC audio files to AAC or OGG.

Project description

Recursively mirror a directory tree of FLAC audio files to AAC/OGG. Source files can be filtered (by sub-directory, or full path) in order to limit the files converted. The script will also attempt to retain all meta-data fields in the output files.

At a Glance

  • Mirror directory tree of FLAC files audio files to AAC/OGG (re-encoded using NeroAacEnc).

  • Filter source tree using one or more sub-directory paths.

  • By default, will only re-encode missing or out-of-date AAC/OGG files.

  • Optionally deletes orphaned output files.

  • Multi-threaded encoding ensures full CPU utilization.

  • Supports transfer of FLAC meta-data including title, artist, album.

  • Converts FLAC replaygain field to Apple iTunes Sound Check.

  • Resizes and embeds album cover art JPEG files to destination files.

Usage Model

  • Hard disk space is cheap, but flash-based media players are still limited in capacity.

  • Create a lossy encoded “mirror” of your music files for portability.

  • Setup a daily cron job to always keep your FLAC and AAC/OGG files synchronized.

  • Re-encode your FLAC library to different AAC/OGG bit-rates in one command.

Running and Options

Flacsync is run from the command-line, using the following format.

flacsync [options] BASE_DIR [SOURCE ...]

BASE_DIR

Define the root path of a directory hierarchy containing desired input files (FLAC). A mirrored output directory will be created in the deepest path, parallel to BASE_DIR, and named after the selected output file extension.

For example, if BASE_DIR is /data/flac, the output dir will be /data/aac.

SOURCE ...

Optional dir/file argument list to select source files for transcoding. If not defined, all files in BASE_DIR will be transcoded. The SOURCE file/dir list must be relative from BASE_DIR or the current working directory.

--version

show program’s version number and exit

-h, --help

show this help message and exit

-c THREAD_COUNT, --threads=THREAD_COUNT

set max number of encoding threads [default:2]

-f, --force

force re-encode of all files from the source dir; by default source files will be skipped if it is determined that an up-to-date copy exists in the destination path

-t ENC_TYPE, --type=ENC_TYPE

select the output transcode format; supported values are ‘aac’,’ogg’ [default:aac]

-o, --ignore-orphans

prevent the removal of files and directories in the dest dir that have no corresponding source file

-d DEST_DIR, --destination=DEST_DIR

define alternate destination output directory to override the default. The standard default destination directory will be created in the same parent directory of BASE_DIR. See BASE_DIR above.

AAC Encoder Options:

-q AAC_Q, --aac-quality=AAC_Q

set the AAC encoder quality value, must be a float range of 0..1 [default:0.35]

OGG Encoder Options:

-g OGG_Q, --ogg-quality=OGG_Q

set the Ogg Vorbis encoder quality value, must be a float range of -1..10 [default:5]

Examples

  1. Encode a directory of FLAC files to AAC. Output file will be written to /music/aac.

    flacsync /music/flac
    cd /music/flac; flacsync .
  2. Encode a directory of FLAC files to AAC. Output files will be written to /ipod.

    flacsync -d /ipod /music/flac
  3. Encode a directory of FLAC files to high-quality OGG, using 4 CPU threads.

    flacsync -c 4 -t ogg -g 9 /music/flac
  4. Force re-encode two albums of FLAC files, even if the AAC files exist.

    flacsync -f /music/flac artist1/album artist2/album
    cd /music/flac; flacsync -f . artist1/album artist2/album

Project details


Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page