Section: User Commands (1)
Updated: 22 May 2016


flactags - print and format some info about FLAC files  


flactags [-e|-e1|-e2|-e3] [-R] [-f format] [-h] [-V] file [file...]  


The flactags command prints either the list of tags in each of the given FLAC files, or specific information about each file according to the given format string. It can escape special characters in ways suitable for CSV (Comma-Separated Values) or TSV (Tab-Separated Values) files.

If compiled with iconv support, flactags tries to honor the locale setting, outputting any values in the local encoding. Use -R to suppress the encoding and output the values in their raw format (i.e., UTF-8).  



Escapes carriage returns, line feeds and backslashes that occur in the values of the tags (as \r, \n and \\, respectively), so that each tag is printed unambiguously and on a single line.

The digit after the option specifies additional levels of escaping. Level 1 also escapes tab characters, viz., as \t. This is useful if flactags is used to produce tab-separated output.

This causes double quotes to be doubled, i.e., they are output as "". This is useful if flactags is used to produce comma-separated values (CSV).

Level 3 combines the above two combined and enables all escapes: carriage returns (\r), newlines (\n), backslashes (\\), tabs (\t) and double quotes ("").
The effect of other numbers than 1, 2 and 3 is undefined.

Raw UTF-8 output. Without this option, the tags from the files are converted to display correctly in the environment ("locale") in which the program is run. If that environment cannot display all characters, they are approximated. With the --raw option, the tags (which are encoded in UTF-8 in the FLAC files) are output without conversion. This is especially useful for scripts, to ensure that no information is lost.
--format format

-f format
If this option is used, the normal output of a list of tags and values is suppressed and the format string is printed instead, once for each file argument.
The format string can contain literal characters, but also variables and escape sequences, which are expanded on printing. Variables can either be written %{tagname} or %x where x is a single letter. Examples are %{TITLE}, %{TRACKNUMBER}, %F and %k. See below for the full list of 1-letter variables and escape sequences.

Shows a brief explanation of the command line options.

Shows the version number of the program and exits without processing any files.


%fFilename without the path [string]
%FFilename with the path [string]
%kFile size in KB [integer]
%aARTIST [string]
%cDESCRIPTION [string]
%gGENRE [string]
%lALBUM [string]
%nTRACKNUMBER [integer]
%tTITLE [string]
%yDATE [string]
%CCOPYRIGHT [string]
%LFLAC version [string]
%o number of channels, 1 = mono, 2 = stereo [integer]
%vSame as %L [string]
%QSampling frequency in Hz [integer]
%qSampling frequency in kHz [float]
%rBit rate in kbps [float]
%mPlaying time: minutes only [integer]
%s Playing time: seconds only [float] (used with %m)
%STotal playing time in seconds [float]
%%A single percent sign

Escape sequences

\tHorizontal tab
\vVertical tab
\rCarriage Return
\fForm Feed
\aAudible Alert (terminal bell)
\xhh Any arbitrary character specified by the hexidecimal number hh
\ooo Any arbitrary character specified by the octal number ooo
\\A single backslash character


flactags exits with 0 on success. If an error occurs, a message is printed on standard error and the program exits with a non-zero status.  


The mp3info(1) command also has the following escapes, which are not supported by flactags: %G (Musical genre number), %e (Emphasis), %E (CRC Error protection), %p (Padding), %u (Number of good audio frames) and %b (Number of corrupt audio frames).  


To create a CSV (Comma-Separated Values) file with two columns, ALBUM and YEAR, from a series of FLAC files, use --escapes=2 (or -e2) to make sure any double quotes inside comment fields are doubled and use a format like this:

flactags --escapes=2 --format='"%{ALBUM}","%{YEAR}"\n' *.flac

To create a TSV (Tab-Separated Values) file instead, use --escapes=1 (or -e1) to escape tabs in tag values and use a format like this:

flactags --escapes=1 --format='%{ALBUM}\t%{YEAR}\n' *.flac

The following prints the file name and bitrate of each of the matching files:

flactags -f 'The bitrate of %F is %r kb/s\n' *.flac



flactags was written by Bert Bos <bert@w3.org>  


metaflac(1) mp3info(1) vorbistags(1)



Escape sequences

This document was created by man2html, using the manual pages.
Time: 01:57:12 GMT, May 25, 2016