Zoog
Updates Opus headers and R128 tags to normalize playback volume for non-R128-aware players.
Install / Use
/learn @FrancisRussell/ZoogREADME
Zoog: Zero Opus Output Gain
Zoog is a Rust library that consists of functionality that can be used to determine the loudness of an Ogg Opus file and also to rewrite that file with new internal gain information as well as loudness-related comment tags. It also has functionality for purely manipulating comment tags of both Ogg Opus and Ogg Vorbis files.
Zoog currently contains two tools, opusgain and zoogcomment. opusgain can
be used to:
-
set the output gain value located in the Opus binary header inside Opus files so that the file plays at the loudness of the original encoded audio, or of that consistent with the ReplayGain or EBU R 128 standards.
-
write the Opus comment tags used by some music players to decide what volume to play an Opus-encoded audio file at.
It is intended to solve the "Opus plays too quietly" problem.
zoogcomment can be used to list, replace or modify the comment tags of Ogg
Opus and Ogg Vorbis files. Its usage is roughly based on that of
vorbiscomment though many options have different naming for improved clarity.
Although zoog exposes a library, its API is unstable and this package is
released on crates.io primarily to allow access to the
command-line tools. The API is documented however, and the reading the source
may prove useful to anyone else wishing to work with Ogg Opus files.
opusgain
opusgain adjusts the Opus binary header for playback at a specific volume and
will always generate the R128_TRACK_GAIN tag and the R128_ALBUM_GAIN tag
(when in album mode) such that files will play at an appropriate volume in
players that support these tags, and at a more appropriate volume in players
that don't. Existing R128_ALBUM_GAIN tags will be stripped when not in album
mode.
opusgain (unlike its predecessor zoog) decodes Opus audio in order to
determine its volume so that it's possible to be certain that all generated
gain values are correct without making assumptions about their existing values.
The following options are available (run opusgain --help for usage):
-
-p PRESET, --preset=PRESETIt is recommended to specify this value explicitly, as the default may change.
-
original: Set the output gain in the Opus binary header to 0dB. In players that do not supportR128tags, this will cause the Opus file to play back at the volume of the originally encoded source. You may want this if you prefer volume normalization to only occur via tags. -
rg: Set the output gain in the Opus binary header to the value that ensures playback will occur at -18 LUFS, which should match the loudness of ReplayGain normalized files. This is probably the best option when you have a player that doesn't know about OpusR128tags, but: -
r128: Set the output gain in the Opus binary header to the value that ensures playback will occur at -23 LUFS, which should match the loudness of files produced byopusencfrom FLAC files which contained ReplayGain information. This is the gain level intended by the Opus authors. -
no-change: Do not change the output gain in the Opus binary header.
-
-
-o MODE, --output-gain-mode=MODE-
auto: Set the output gain in the Opus binary header such that each track is album-normalized in album mode, or track-normalized otherwise. In album mode, this results in all tracks having the same output gain value as well as the sameR128_ALBUM_GAINtag. -
track: Set the output gain in the Opus binary header such that each track is track-normalized, even if album mode is enabled. In album mode, this results in all tracks being given different output gain values as well as differentR128_ALBUM_GAINtags, but theirR128_TRACK_GAINtags will be identical. Unless you know what you're doing, you probably don't want this option.
-
-
-a, --album: Enables album mode. This causesR128_ALBUM_GAINtags to also be generated. These tell players that support these tags what gain to apply so that each track in the album maintains its relative loudness. By default the output gain value for each file will be set to identical values in order to apply the calculated album gain, but this behaviour can be overridden using the--output-gain-modeoption. -
-j N, --num-threads=N: UseNthreads for processing. The default is to use the number of cores detected on the system. Larger numbers will be rounded down to this value. To avoid high disk space usage during processing, or a large number of temporary files left around after an error, only one file will be rewritten at a time regardless of the number of threads. -
-c, --clear: Remove allR128tags from the specified files. The output gain of each file is unchanged, regardless of the specified preset. -
-M,--minimize-mtime-change: Attempts to apply the smallest increment possible (filesystem dependent) to the modification time of the file. This is deliberately not a preserve in order to avoid misleading backup/data-transfer programs that use this information to determine if a file has changed. On modern filesystems (ext4, APFS, btrfs) this is typically a nanosecond, but could be up to two seconds on older filesystems (ext3, FAT32). -
-n, --dry-run: Displays the same output thatopusgainwould otherwise produce, but does not make any changes to the supplied files. -
-I PATH_PROCESSING_MODE, --interpret-paths=PATH_PROCESSING_MODEThis option controls how the supplied paths are interpreted.
-
files-singles(default): Each supplied path must be to a file. Files are normalized independently, with any album tags being removed. It is an error to supply a folder. -
files-album: Each supplied path must be to a file. Files are treated as all belonging to the same album and album normalization tags will be generated. It is an error to supply a folder. This option is equivalent to supplying the-aor--albumflag. -
folders-are-albums: Each file path supplied is treated as a single, with album tags being removed. Each supplied folder path is explored (including recursive traversal of sub-folders) with all found Opus files being treated as part of a single album. This option therefore makes it possible to apply multiple album normalizations in a singleopusgaininvocation. Which files inside folders are considered Ogg Opus files is controlled by the--file-extensionsoption.For example, if you had the files:
a.opus album1/b.opus album1/c.opus album2/e.opus album2/f.opus d.opusThen
opusgain -I folders-are-albums *in that folder would be expanded (by the shell on Linux/MacOS or byopusgainon Windows) toopusgain -I folders-are-albums a.opus album1 album2 d.opuswitha.opusandd.opusbeing treated as singles andalbum1andalbum2being normalized as independent albums.
-
-
-e FILE_EXTENSIONS,--file-extensions=FILE_EXTENSIONS: When folders are passed on the command line to be searched for files, this option determines what file extensions are considered to be Ogg Opus files. Multiple extensions may be supplied separated by commas. By default this value isopus, butogg,opuscould be supplied to assume that all found.oggfiles are Ogg Opus as well.
If the internal gain and tag values are already correct for the specified files,
opusgain will avoid rewriting them.
Sequentially multiplexed or "chained" Ogg Opus streams are not supported.
opusgain supports Unix shell style wildcards under Windows, where wildcards
must be handled by the application rather than expanded by the shell.
zoogcomment
zoogcomment can be used to delete, append, replace and list the comments
located in an Ogg Opus or Ogg Vorbis file.
The following options are available (run zoogcomment --help for usage):
-
-l, --list: List all tags in the file inNAME=VALUEformat. This will be to standard output unless-Ois specified. -
-m, --modify: Tags specified using-tor-Iwill be appended to the specified file. Tags matching patterns specified using-dwill be removed from the existing tags on the file. -
-r, --replace: All existing tags in the file will be removed and will be replaced with those specified using-tor-I. -
-t NAME=VALUE, --tag NAME=VALUE. The specified tag is will be added to the file in modify or replace mode. -
-d NAME[=VALUE], --delete NAME[=VALUE]. Specifies either a tag name, or a name-value mapping to be deleted. All tags that match the pattern will be removed, not just the first. This option is only valid in modify mode. -
-e, --escapes: In all tag input/output either on the command-line or to/from a file escapes will be used for line-feeds (\n), carriage returns (\r), backslashes (\\) and the null character (\0). All other escapes are invalid. This option makes it possible to specify tags which contain newlines which would otherwise fail to be parsed correctly from a comment file. -
-I COMMENT_FILE, --tags-in COMMENT_FILE: In the modify and replace modes, the tags to added will be read from this file in addition to those specified on the command line. Tags are read inNAME=VALUEformat, with one tag per line. If-is specified for the
Related Skills
docs-writer
99.3k`docs-writer` skill instructions As an expert technical writer and editor for the Gemini CLI project, you produce accurate, clear, and consistent documentation. When asked to write, edit, or revie
model-usage
339.3kUse CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar cost JSON.
Design
Campus Second-Hand Trading Platform \- General Design Document (v5.0 \- React Architecture \- Complete Final Version)1\. System Overall Design 1.1. Project Overview This project aims t
ddd
Guía de Principios DDD para el Proyecto > 📚 Documento Complementario : Este documento define los principios y reglas de DDD. Para ver templates de código, ejemplos detallados y guías paso
