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