| 1 |
.TH opustags 1 "April 2024" "@PROJECT_NAME@ @PROJECT_VERSION@" |
| 2 |
.SH NAME |
| 3 |
opustags \- Ogg Opus tag editor |
| 4 |
.SH SYNOPSIS |
| 5 |
.B opustags --help |
| 6 |
.br |
| 7 |
.B opustags |
| 8 |
.RI [ OPTIONS ] |
| 9 |
.I INPUT |
| 10 |
.br |
| 11 |
.B opustags |
| 12 |
.I OPTIONS |
| 13 |
.B -i |
| 14 |
\fIFILE\fP... |
| 15 |
.br |
| 16 |
.B opustags |
| 17 |
.I OPTIONS |
| 18 |
.B -o |
| 19 |
.I OUTPUT INPUT |
| 20 |
.SH DESCRIPTION |
| 21 |
.PP |
| 22 |
\fBopustags\fP can read and edit the comment header of an Ogg Opus file. |
| 23 |
It has two modes: read-only, and read-write for tag editing. |
| 24 |
.PP |
| 25 |
In read-only mode, only the beginning of \fIINPUT\fP is read, and the tags are |
| 26 |
printed on standard output. Lines prefixed by tabs are continuation of the previous tag. |
| 27 |
\fIINPUT\fP can either be the name of a file or \fB-\fP to read from standard input. |
| 28 |
You can use the options below to edit the tags before printing them. |
| 29 |
This could be useful to preview some changes before writing them. |
| 30 |
.PP |
| 31 |
In editing mode, you need to specify an output file with \fB--output\fP, or use \fB--in-place\fP to |
| 32 |
overwrite the input files. If the output is a regular file, the result is first written to a |
| 33 |
temporary file and then moved to its final location on success. On error, the temporary output file |
| 34 |
is deleted. |
| 35 |
.PP |
| 36 |
Tag editing can be performed with the \fB--add\fP, \fB--delete\fP and \fB--set\fP |
| 37 |
options. Options can be specified in any order and don’t conflict with each other. |
| 38 |
First the specified tags are deleted, then the new tags are added. |
| 39 |
.PP |
| 40 |
You can delete all the tags with \fB--delete-all\fP. This operation can be combined with \fB--add\fP |
| 41 |
to set new tags without being bothered by the old ones. |
| 42 |
.PP |
| 43 |
If you want to replace all the tags, you can use the \fB--set-all\fP option which will cause |
| 44 |
\fBopustags\fP to read tags from standard input. |
| 45 |
The format is the same as the one used for output: newline-separated \fIFIELD=Value\fP assignment. |
| 46 |
All the previously existing tags as deleted. |
| 47 |
.PP |
| 48 |
The Opus format specifications requires that tags are encoded in UTF-8, so that's the only encoding |
| 49 |
opustags supports. If your system encoding is different, the tags are automatically converted to and |
| 50 |
from your system locale. When you edit an Opus file whose tags contains characters unsupported by |
| 51 |
your system encoding, the original UTF-8 values will be preserved for the tags you don't explicitly |
| 52 |
modify. |
| 53 |
.SH OPTIONS |
| 54 |
.TP |
| 55 |
.B \-h, \-\-help |
| 56 |
Display a brief description of the options. |
| 57 |
.TP |
| 58 |
.B \-o, \-\-output \fIFILE\fI |
| 59 |
Specify the output file. |
| 60 |
The input file will be read, its tags edited, then written to the specified output file. If |
| 61 |
\fIFILE\fP is \fB-\fP then the resulting Opus file will be written to standard output. |
| 62 |
The output file can’t be the same as the input file. |
| 63 |
.TP |
| 64 |
.B \-i, \-\-in-place |
| 65 |
Overwrite the input file instead of creating a separate output file. It has the same effect as |
| 66 |
setting \fB--output\fP to the same path as the input file and enabling \fB--overwrite\fP. |
| 67 |
This option conflicts with \fB--output\fP. |
| 68 |
.TP |
| 69 |
.B \-y, \-\-overwrite |
| 70 |
By default, \fBopustags\fP refuses to overwrite an already-existent file. |
| 71 |
Use \fB-y\fP to allow overwriting. |
| 72 |
Note that this option is not needed when the output is a special file like \fI/dev/null\fP. |
| 73 |
.TP |
| 74 |
.B \-d, \-\-delete \fIFIELD[=VALUE]\fP |
| 75 |
If value is not specified, delete all the tags whose field name is \fIFIELD\fP. |
| 76 |
Otherwise, delete all the comments whose field name is \fIFIELD\fP and value is \fIVALUE\fP. |
| 77 |
In both cases, the field names are case-insensitive, and expected to be ASCII. |
| 78 |
.TP |
| 79 |
.B \-a, \-\-add \fIFIELD=VALUE\fP |
| 80 |
Add a tag. Note that multiple tags with the same field name are perfectly acceptable, so you can add |
| 81 |
multiple fields with the same name, and previously existing tags will also be preserved. |
| 82 |
When the \fB--delete\fP is used with the same \fIFIELD\fP, only the older tags are deleted. |
| 83 |
.TP |
| 84 |
.B \-s, \-\-set \fIFIELD=VALUE\fP |
| 85 |
This option is provided for convenience. It delete all the fields of the same |
| 86 |
type that may already exist, then adds it with the wanted value. |
| 87 |
This is strictly equivalent to \fB--delete\fP \fIFIELD\fP \fB--add\fP |
| 88 |
\fIFIELD=VALUE\fP. You can combine it with \fB--add\fP to add tags of the same |
| 89 |
type. As deletion occurs before adding, \fB--set\fP won’t erase the tags |
| 90 |
added with \fB--add\fP. |
| 91 |
.TP |
| 92 |
.B \-D, \-\-delete-all |
| 93 |
Delete all the previously existing tags. |
| 94 |
.TP |
| 95 |
.B \-S, \-\-set-all |
| 96 |
Sets the tags from scratch. |
| 97 |
All the original tags are deleted and new ones are read from standard input. |
| 98 |
Each line must specify a \fIFIELD=VALUE\fP pair and be separated with line feeds. |
| 99 |
Empty lines and lines starting with \fI#\fP are ignored. |
| 100 |
Multiline tags must have their continuation lines prefixed by a single tab (in other words, every |
| 101 |
\fI\\n\fP must be replaced by \fI\\n\\t\fP). |
| 102 |
.TP |
| 103 |
.B \-e, \-\-edit |
| 104 |
Edit tags interactively by spawning the program specified by the EDITOR |
| 105 |
environment variable. The allowed format is the same as \fB--set-all\fP. |
| 106 |
If TERM and VISUAL are set, VISUAL takes precedence over EDITOR. |
| 107 |
.TP |
| 108 |
.B \-\-output-cover \fIFILE\fP |
| 109 |
Save the cover art of the input Opus file to the specified location. |
| 110 |
If the input file does not contain any cover art, this option has no effect. |
| 111 |
To allow overwriting the target location, specify \fB--overwrite\fP. |
| 112 |
In the case of multiple pictures embedded in the Opus tags, only the first one is saved. |
| 113 |
Note that the since the image format is not fixed, you should consider an extension-less file name |
| 114 |
and rely on the magic number to deduce the type. opustags does not add or check the target file’s |
| 115 |
extension. |
| 116 |
You can specify \fB-\fP for standard output, in which case the regular output will be suppressed. |
| 117 |
.TP |
| 118 |
.B \-\-set-cover \fIFILE\fP |
| 119 |
Replace or set the cover art to the specified picture. |
| 120 |
Specify \fB-\fP to read the picture from standard input. |
| 121 |
In theory, an Opus file may contain multiple pictures with different roles, though in practice only |
| 122 |
the front cover really matters. opustags can currently only handle one front cover and nothing else. |
| 123 |
.TP |
| 124 |
.B \-\-vendor |
| 125 |
Print the vendor string from the OpusTags packet and do nothing else. Standard tags operations are |
| 126 |
not supported when specifying this flag. |
| 127 |
.TP |
| 128 |
.B \-\-set-vendor \fIVALUE\fP |
| 129 |
Replace the vendor string by the specified value. This action can be performed alongside tag |
| 130 |
edition. |
| 131 |
.TP |
| 132 |
.B \-\-raw |
| 133 |
OpusTags metadata should always be encoded in UTF-8, as per RFC 7845. However, some files may be |
| 134 |
corrupted or possibly even contain intentional binary data. In that case, --raw lets you edit that |
| 135 |
kind of binary data without ensuring the validity of the tags encoding. This option may also be |
| 136 |
useful when your system encoding is different from UTF-8 and you wish to preserve the full UTF-8 |
| 137 |
character set even though your system cannot display it. |
| 138 |
.TP |
| 139 |
.B \-z |
| 140 |
When editing tags programmatically with line-based tools like grep or sed, tags containing newlines |
| 141 |
are likely to corrupt the result because these tools won’t interpret multi-line tags as a whole. To |
| 142 |
make automatic processing easier, \fB-z\fP delimits tags by a null byte (ASCII NUL) instead of line |
| 143 |
feeds. That same \fB-z\fP flag is also supported by GNU grep or GNU sed and, combined with opustags |
| 144 |
-z, would make them process the input tag-by-tag instead of line-by-line, thus supporting multi-line |
| 145 |
tags as well. This option also disables the TAB prefix for continuation lines after a line feed. |
| 146 |
.SH EXAMPLES |
| 147 |
.PP |
| 148 |
List all the tags in file foo.opus: |
| 149 |
.PP |
| 150 |
opustags foo.opus |
| 151 |
.PP |
| 152 |
Copy in.opus to out.opus, with the TITLE tag added: |
| 153 |
.PP |
| 154 |
opustags in.opus --output out.opus --add "TITLE=Hello world!" |
| 155 |
.PP |
| 156 |
Remove the previously existing ARTIST tags and add the two X and Y ARTIST tags, then display the new |
| 157 |
tags without writing them to the Opus file: |
| 158 |
.PP |
| 159 |
opustags in.opus --add ARTIST=X --add ARTIST=Y --delete ARTIST |
| 160 |
.PP |
| 161 |
Edit tags interactively in Vim: |
| 162 |
.PP |
| 163 |
EDITOR=vim opustags --in-place --edit file.opus |
| 164 |
.PP |
| 165 |
Replace all the tags in dest.opus with the ones from src.opus: |
| 166 |
.PP |
| 167 |
opustags src.opus | opustags --in-place dest.opus --set-all |
| 168 |
.PP |
| 169 |
Use GNU grep to remove all the CHAPTER* tags, with -z to support multi-line tags: |
| 170 |
.PP |
| 171 |
opustags -z file.opus | grep -z -v ^CHAPTER | opustags -z --in-place file.opus --set-all |
| 172 |
.SH CAVEATS |
| 173 |
.PP |
| 174 |
\fBopustags\fP currently has the following limitations: |
| 175 |
.IP \[bu] |
| 176 |
Multiplexed streams are not supported. |
| 177 |
.IP \[bu] |
| 178 |
Control characters inside tags are printed raw rather than being escaped. |
| 179 |
.PP |
| 180 |
Internally, the OpusTags packet in an Ogg Opus file may contain extra arbitrary binary data after |
| 181 |
the comments. This block of data is currently not editable, but is always preserved. The same |
| 182 |
applies for the vendor string. |
| 183 |
.PP |
| 184 |
If you need a feature not currently supported, feel free to open an issue or send an email with your |
| 185 |
use case. |
| 186 |
.SH AUTHOR |
| 187 |
Frédéric Mangano <[email protected]> |
| 188 |
.PP |
| 189 |
Report bugs at <https://github.com/fmang/opustags/issues> |