xref: /aosp_15_r20/external/flac/man/metaflac.md (revision 600f14f40d737144c998e2ec7a483122d3776fbc)
1*600f14f4SXin Li% metaflac(1) Version 1.4.3 | Free Lossless Audio Codec metadata tool
2*600f14f4SXin Li
3*600f14f4SXin Li# NAME
4*600f14f4SXin Li
5*600f14f4SXin Limetaflac - program to list, add, remove, or edit metadata in one or more
6*600f14f4SXin LiFLAC files.
7*600f14f4SXin Li
8*600f14f4SXin Li# SYNOPSIS
9*600f14f4SXin Li
10*600f14f4SXin Li**metaflac** \[ *options* \] \[ *operations* \] *FLACfile ...*
11*600f14f4SXin Li
12*600f14f4SXin Li# DESCRIPTION
13*600f14f4SXin Li
14*600f14f4SXin LiUse **metaflac** to list, add, remove, or edit metadata in one or more
15*600f14f4SXin LiFLAC files. You may perform one major operation, or many shorthand
16*600f14f4SXin Lioperations at a time.
17*600f14f4SXin Li
18*600f14f4SXin Li# GENERAL USAGE
19*600f14f4SXin Li
20*600f14f4SXin Limetaflac is the command-line .flac file metadata editor. You can use it
21*600f14f4SXin Lito list the contents of metadata blocks, edit, delete or insert blocks,
22*600f14f4SXin Liand manage padding.
23*600f14f4SXin Li
24*600f14f4SXin Limetaflac takes a set of "options" (though some are not optional) and a
25*600f14f4SXin Liset of FLAC files to operate on. There are three kinds of "options":
26*600f14f4SXin Li
27*600f14f4SXin Li- Major operations, which specify a mode of operation like listing
28*600f14f4SXin Li  blocks, removing blocks, etc. These will have sub-operations describing
29*600f14f4SXin Li  exactly what is to be done.
30*600f14f4SXin Li
31*600f14f4SXin Li- Shorthand operations, which are convenient synonyms for major
32*600f14f4SXin Li  operations. For example, there is a shorthand operation
33*600f14f4SXin Li  --show-sample-rate that shows just the sample rate field from the
34*600f14f4SXin Li  STREAMINFO metadata block.
35*600f14f4SXin Li
36*600f14f4SXin Li- Global options, which affect all the operations.
37*600f14f4SXin Li
38*600f14f4SXin LiAll of these are described in the tables below. At least one shorthand
39*600f14f4SXin Lior major operation must be supplied. You can use multiple shorthand
40*600f14f4SXin Lioperations to do more than one thing to a file or set of files. Most of
41*600f14f4SXin Lithe common things to do to metadata have shorthand operations. As an
42*600f14f4SXin Liexample, here is how to show the MD5 signatures for a set of three FLAC
43*600f14f4SXin Lifiles:
44*600f14f4SXin Li
45*600f14f4SXin Li`metaflac --show-md5sum file1.flac file2.flac file3.flac`
46*600f14f4SXin Li
47*600f14f4SXin LiAnother example; this removes all DESCRIPTION and COMMENT tags in a set
48*600f14f4SXin Liof FLAC files, and uses the --preserve-modtime global option to keep the
49*600f14f4SXin LiFLAC file modification times the same (usually when files are edited the
50*600f14f4SXin Limodification time is set to the current time):
51*600f14f4SXin Li
52*600f14f4SXin Li`metaflac --preserve-modtime --remove-tag=DESCRIPTION --remove-tag=COMMENT file1.flac file2.flac file3.flac`
53*600f14f4SXin Li
54*600f14f4SXin Li# OPTIONS
55*600f14f4SXin Li
56*600f14f4SXin Li**\--preserve-modtime**
57*600f14f4SXin Li:	Preserve the original modification time in spite of edits.
58*600f14f4SXin Li
59*600f14f4SXin Li**\--with-filename**
60*600f14f4SXin Li:	Prefix each output line with the FLAC file name (the default if more
61*600f14f4SXin Li	than one FLAC file is specified). This option has no effect for
62*600f14f4SXin Li	options exporting to a file, like --export-tags-to.
63*600f14f4SXin Li
64*600f14f4SXin Li**\--no-filename**
65*600f14f4SXin Li:	Do not prefix each output line with the FLAC file name (the default
66*600f14f4SXin Li	if only one FLAC file is specified).
67*600f14f4SXin Li
68*600f14f4SXin Li**\--no-utf8-convert**
69*600f14f4SXin Li:	Do not convert tags from UTF-8 to local charset, or vice versa. This
70*600f14f4SXin Li	is useful for scripts, and setting tags in situations where the
71*600f14f4SXin Li	locale is wrong.
72*600f14f4SXin Li
73*600f14f4SXin Li**\--dont-use-padding**
74*600f14f4SXin Li:	By default metaflac tries to use padding where possible to avoid
75*600f14f4SXin Li	rewriting the entire file if the metadata size changes. Use this
76*600f14f4SXin Li	option to tell metaflac to not take advantage of padding this way.
77*600f14f4SXin Li
78*600f14f4SXin Li# SHORTHAND OPERATIONS
79*600f14f4SXin Li
80*600f14f4SXin Li**\--show-md5sum**
81*600f14f4SXin Li:	Show the MD5 signature from the STREAMINFO block.
82*600f14f4SXin Li
83*600f14f4SXin Li**\--show-min-blocksize**
84*600f14f4SXin Li:	Show the minimum block size from the STREAMINFO block.
85*600f14f4SXin Li
86*600f14f4SXin Li**\--show-max-blocksize**
87*600f14f4SXin Li:	Show the maximum block size from the STREAMINFO block.
88*600f14f4SXin Li
89*600f14f4SXin Li**\--show-min-framesize**
90*600f14f4SXin Li:	Show the minimum frame size from the STREAMINFO block.
91*600f14f4SXin Li
92*600f14f4SXin Li**\--show-max-framesize**
93*600f14f4SXin Li:	Show the maximum frame size from the STREAMINFO block.
94*600f14f4SXin Li
95*600f14f4SXin Li**\--show-sample-rate**
96*600f14f4SXin Li:	Show the sample rate from the STREAMINFO block.
97*600f14f4SXin Li
98*600f14f4SXin Li**\--show-channels**
99*600f14f4SXin Li:	Show the number of channels from the STREAMINFO block.
100*600f14f4SXin Li
101*600f14f4SXin Li**\--show-bps**
102*600f14f4SXin Li:	Show the \# of bits per sample from the STREAMINFO block.
103*600f14f4SXin Li
104*600f14f4SXin Li**\--show-total-samples**
105*600f14f4SXin Li:	Show the total \# of samples from the STREAMINFO block.
106*600f14f4SXin Li
107*600f14f4SXin Li**\--show-vendor-tag**
108*600f14f4SXin Li:	Show the vendor string from the VORBIS_COMMENT block.
109*600f14f4SXin Li
110*600f14f4SXin Li**\--show-tag=name**
111*600f14f4SXin Li:	Show all tags where the field name matches 'name'.
112*600f14f4SXin Li
113*600f14f4SXin Li**\--show-all-tags**
114*600f14f4SXin Li:	Show all tags. This is an alias for --export-tags-to=-.
115*600f14f4SXin Li
116*600f14f4SXin Li**\--remove-tag=name**
117*600f14f4SXin Li:	Remove all tags whose field name is 'name'.
118*600f14f4SXin Li
119*600f14f4SXin Li**\--remove-first-tag=name**
120*600f14f4SXin Li:	Remove first tag whose field name is 'name'.
121*600f14f4SXin Li
122*600f14f4SXin Li**\--remove-all-tags**
123*600f14f4SXin Li:	Remove all tags, leaving only the vendor string.
124*600f14f4SXin Li
125*600f14f4SXin Li**\--remove-all-tags-except=NAME1\[=NAME2\[=...\]\]**
126*600f14f4SXin Li:   Remove all tags, except the vendor string and the tag names
127*600f14f4SXin Li    specified. Tag names must be separated by an = character.
128*600f14f4SXin Li
129*600f14f4SXin Li**\--set-tag=field**
130*600f14f4SXin Li:	Add a tag. The field must comply with the Vorbis comment spec, of the
131*600f14f4SXin Li	form "NAME=VALUE". If there is currently no tag block, one will be
132*600f14f4SXin Li	created.
133*600f14f4SXin Li
134*600f14f4SXin Li**\--set-tag-from-file=field**
135*600f14f4SXin Li:	Like \--set-tag, except the VALUE is a filename whose contents will
136*600f14f4SXin Li	be read verbatim to set the tag value. Unless \--no-utf8-convert is
137*600f14f4SXin Li	specified, the contents will be converted to UTF-8 from the local
138*600f14f4SXin Li	charset. This can be used to store a cuesheet in a tag (e.g.
139*600f14f4SXin Li	\--set-tag-from-file="CUESHEET=image.cue"). Do not try to store
140*600f14f4SXin Li	binary data in tag fields! Use APPLICATION blocks for that.
141*600f14f4SXin Li
142*600f14f4SXin Li**\--import-tags-from=file**
143*600f14f4SXin Li:	Import tags from a file. Use '-' for stdin. Each line should be of
144*600f14f4SXin Li	the form NAME=VALUE. Multi-line comments are currently not supported.
145*600f14f4SXin Li	Specify \--remove-all-tags and/or \--no-utf8-convert before
146*600f14f4SXin Li	\--import-tags-from if necessary. If FILE is '-' (stdin), only one
147*600f14f4SXin Li	FLAC file may be specified.
148*600f14f4SXin Li
149*600f14f4SXin Li**\--export-tags-to=file**
150*600f14f4SXin Li:	Export tags to a file. Use '-' for stdout. Each line will be of the
151*600f14f4SXin Li	form NAME=VALUE. Specify \--no-utf8-convert if necessary.
152*600f14f4SXin Li
153*600f14f4SXin Li**\--import-cuesheet-from=file**
154*600f14f4SXin Li:	Import a cuesheet from a file. Use '-' for stdin. Only one FLAC file
155*600f14f4SXin Li	may be specified. A seekpoint will be added for each index point in
156*600f14f4SXin Li	the cuesheet to the SEEKTABLE unless \--no-cued-seekpoints is
157*600f14f4SXin Li	specified.
158*600f14f4SXin Li
159*600f14f4SXin Li**\--export-cuesheet-to=file**
160*600f14f4SXin Li:	Export CUESHEET block to a cuesheet file, suitable for use by CD
161*600f14f4SXin Li	authoring software. Use '-' for stdout. Only one FLAC file may be
162*600f14f4SXin Li	specified on the command line.
163*600f14f4SXin Li
164*600f14f4SXin Li**\--import-picture-from={***FILENAME***\|***SPECIFICATION***}**
165*600f14f4SXin Li:	Import a picture and store it in a PICTURE metadata block. More than
166*600f14f4SXin Li	one \--import-picture-from command can be specified. Either a filename
167*600f14f4SXin Li	for the picture file or a more complete specification form can be
168*600f14f4SXin Li	used. The SPECIFICATION is a string whose parts are separated by \|
169*600f14f4SXin Li	(pipe) characters. Some parts may be left empty to invoke default
170*600f14f4SXin Li	values. FILENAME is just shorthand for "\|\|\|\|FILENAME". For
171*600f14f4SXin Li	details on the specification, see the section **Picture
172*600f14f4SXin Li	specification** in the **flac(1)** man page.
173*600f14f4SXin Li
174*600f14f4SXin Li**\--export-picture-to=file**
175*600f14f4SXin Li:	Export PICTURE block to a file. Use '-' for stdout. Only one FLAC
176*600f14f4SXin Li	file may be specified on the command line. The first PICTURE block
177*600f14f4SXin Li	will be exported unless \--export-picture-to is preceded by a
178*600f14f4SXin Li	\--block-number=# option to specify the exact metadata block to
179*600f14f4SXin Li	extract. Note that the block number is the one shown by \--list.
180*600f14f4SXin Li
181*600f14f4SXin Li**\--add-replay-gain**
182*600f14f4SXin Li:	Calculates the title and album gains/peaks of the given FLAC files as
183*600f14f4SXin Li	if all the files were part of one album, then stores them as FLAC
184*600f14f4SXin Li	tags. The tags are the same as those used by vorbisgain. Existing
185*600f14f4SXin Li	ReplayGain tags will be replaced. If only one FLAC file is given,
186*600f14f4SXin Li	the album and title gains will be the same. Since this operation
187*600f14f4SXin Li	requires two passes, it is always executed last, after all other
188*600f14f4SXin Li	operations have been completed and written to disk. All FLAC files
189*600f14f4SXin Li	specified must have the same resolution, sample rate, and number of
190*600f14f4SXin Li	channels. Only mono and stereo files are allowed, and the sample
191*600f14f4SXin Li	rate must be 8, 11.025, 12, 16, 18.9, 22.05, 24, 28, 32, 36, 37.8,
192*600f14f4SXin Li	44.1, 48, 56, 64, 72, 75.6, 88.2, 96, 112, 128, 144, 151.2, 176.4,
193*600f14f4SXin Li	192, 224, 256, 288, 302.4, 352.8, 384, 448, 512, 576, or 604.8 kHz.
194*600f14f4SXin Li
195*600f14f4SXin Li**\--scan-replay-gain**
196*600f14f4SXin Li:	Like \--add-replay-gain, but only analyzes the files rather than
197*600f14f4SXin Li	writing them to the tags.
198*600f14f4SXin Li
199*600f14f4SXin Li**\--remove-replay-gain**
200*600f14f4SXin Li:	Removes the ReplayGain tags.
201*600f14f4SXin Li
202*600f14f4SXin Li**\--add-seekpoint={***\#***\|***X***\|***\#x***\|***\#s***}**
203*600f14f4SXin Li:	Add seek points to a SEEKTABLE block. Using \#, a seek point at that
204*600f14f4SXin Li	sample number is added. Using X, a placeholder point is added at the
205*600f14f4SXin Li	end of a the table. Using \#x, \# evenly spaced seek points will be
206*600f14f4SXin Li	added, the first being at sample 0. Using \#s, a seekpoint will be
207*600f14f4SXin Li	added every \# seconds (# does not have to be a whole number; it can
208*600f14f4SXin Li	be, for example, 9.5, meaning a seekpoint every 9.5 seconds). If no
209*600f14f4SXin Li	SEEKTABLE block exists, one will be created. If one already exists,
210*600f14f4SXin Li	points will be added to the existing table, and any duplicates will
211*600f14f4SXin Li	be turned into placeholder points. You may use many \--add-seekpoint
212*600f14f4SXin Li	options; the resulting SEEKTABLE will be the unique-ified union of
213*600f14f4SXin Li	all such values. Example: \--add-seekpoint=100x \--add-seekpoint=3.5s
214*600f14f4SXin Li	will add 100 evenly spaced seekpoints and a seekpoint every 3.5
215*600f14f4SXin Li	seconds.
216*600f14f4SXin Li
217*600f14f4SXin Li**\--add-padding=length**
218*600f14f4SXin Li:	Add a padding block of the given length (in bytes). The overall
219*600f14f4SXin Li	length of the new block will be 4 + length; the extra 4 bytes is for
220*600f14f4SXin Li	the metadata block header.
221*600f14f4SXin Li
222*600f14f4SXin Li# MAJOR OPERATIONS
223*600f14f4SXin Li
224*600f14f4SXin Li**\--list**
225*600f14f4SXin Li:	List the contents of one or more metadata blocks to stdout. By
226*600f14f4SXin Li	default, all metadata blocks are listed in text format. Use the
227*600f14f4SXin Li	options **\--block-number**, **\--block-type** or
228*600f14f4SXin Li	**\--except-block-type** to change this behavior.
229*600f14f4SXin Li
230*600f14f4SXin Li**\--remove**
231*600f14f4SXin Li:	Remove one or more metadata blocks from the metadata. Use the options
232*600f14f4SXin Li	**\--block-number**, **\--block-type** or **\--except-block-type**
233*600f14f4SXin Li	to specify which blocks should be removed. Note that if both
234*600f14f4SXin Li	\--block-number and \--[except-]block-type are specified, the result
235*600f14f4SXin Li	is the logical AND of both arguments. Unless \--dont-use-padding
236*600f14f4SXin Li	is specified, the blocks will be replaced with padding. You may not
237*600f14f4SXin Li	remove the STREAMINFO block.
238*600f14f4SXin Li
239*600f14f4SXin Li**\--block-number=#\[,#\[...\]\]**
240*600f14f4SXin Li:	An optional comma-separated list of block numbers to display. The
241*600f14f4SXin Li	first block, the STREAMINFO block, is block 0.
242*600f14f4SXin Li
243*600f14f4SXin Li**\--block-type=type\[,type\[...\]\]**
244*600f14f4SXin Li
245*600f14f4SXin Li**\--except-block-type=type\[,type\[...\]\]**
246*600f14f4SXin Li:	An optional comma-separated list of block types to be included or
247*600f14f4SXin Li	ignored with this option. Use only one of \--block-type or
248*600f14f4SXin Li	\--except-block-type. The valid block types are: STREAMINFO, PADDING,
249*600f14f4SXin Li	APPLICATION, SEEKTABLE, VORBIS_COMMENT, PICTURE. You may narrow down
250*600f14f4SXin Li	the types of APPLICATION blocks selected by appending APPLICATION
251*600f14f4SXin Li	with a colon and the ID of the APPLICATION block in either ASCII
252*600f14f4SXin Li	or hexadecimal representation. E.g.	APPLICATION:abcd for the
253*600f14f4SXin Li	APPLICATION block(s) whose textual representation of the 4-byte ID
254*600f14f4SXin Li	is "abcd" or APPLICATION:0xXXXXXXXX for the APPLICATION block(s)
255*600f14f4SXin Li	whose hexadecimal big- endian representation of the 4-byte ID
256*600f14f4SXin Li	is "0xXXXXXXXX". For the example "abcd" above the hexadecimal
257*600f14f4SXin Li	equivalalent is 0x61626364
258*600f14f4SXin Li
259*600f14f4SXin Li**\--application-data-format=hexdump\|text**
260*600f14f4SXin Li:	If the application block you are displaying contains binary data but
261*600f14f4SXin Li	your \--data-format=text, you can display a hex dump of the
262*600f14f4SXin Li	application data contents instead using
263*600f14f4SXin Li	\--application-data-format=hexdump.
264*600f14f4SXin Li
265*600f14f4SXin Li**\--data-format=binary\|binary-headerless\|text**
266*600f14f4SXin Li:	For use with --list. By default a human-readable text
267*600f14f4SXin Li	representation of the data is isplayed. You may specify
268*600f14f4SXin Li	--data-format=binary to dump the raw binary form of each metadata
269*600f14f4SXin Li	block. Specify --data-format=binary-headerless to omit output of
270*600f14f4SXin Li	metadata block headers, including the id of APPLICATION metadata
271*600f14f4SXin Li	blocks.
272*600f14f4SXin Li
273*600f14f4SXin Li**\--append**
274*600f14f4SXin Li:	Insert a metadata block from a file. This must be a binary block as
275*600f14f4SXin Li	exported with --list --data-format=binary. The insertion point is
276*600f14f4SXin Li	defined with --block-number=#.  The new block will be added after the
277*600f14f4SXin Li	given block number.  This prevents the illegal insertion of a block
278*600f14f4SXin Li	before the first STREAMINFO block.  You may not --append another
279*600f14f4SXin Li	STREAMINFO block. It is possible to copy a metadata block from one
280*600f14f4SXin Li	file to another with this option. For example use
281*600f14f4SXin Li	`metaflac --list --data-format=binary --block-number=6 file.flac > block`
282*600f14f4SXin Li	to export the block, and then import it with
283*600f14f4SXin Li	`metaflac --append anotherfile.flac < block`
284*600f14f4SXin Li
285*600f14f4SXin Li**\--remove-all**
286*600f14f4SXin Li:	Remove all metadata blocks (except the STREAMINFO block) from the
287*600f14f4SXin Li	metadata. Unless \--dont-use-padding is specified, the blocks will be
288*600f14f4SXin Li	replaced with padding.
289*600f14f4SXin Li
290*600f14f4SXin Li**\--merge-padding**
291*600f14f4SXin Li:	Merge adjacent PADDING blocks into single blocks.
292*600f14f4SXin Li
293*600f14f4SXin Li**\--sort-padding**
294*600f14f4SXin Li:	Move all PADDING blocks to the end of the metadata and merge them
295*600f14f4SXin Li	into a single block.
296*600f14f4SXin Li
297*600f14f4SXin Li# SEE ALSO
298*600f14f4SXin Li
299*600f14f4SXin Li**flac(1)**
300