How to Edit WAV Metadata and Extra Fields in FFmpeg

This article provides a quick overview of how to manipulate WAV (Waveform Audio File Format) header fields, metadata, and extra chunks using FFmpeg. While FFmpeg includes an extrafield filter, this specific filter is designed for video bitstreams rather than audio. To modify the extra format fields, Broadcast Wave Format (BWF) data, and metadata chunks of a WAV file, you must use FFmpeg’s dedicated audio muxer options and metadata flags.


Clarifying the “extrafield” Filter in FFmpeg

In FFmpeg, extrafield is a video filter, not an audio filter. It is used to write or modify extra field information (such as interlacing flags) in video packets.

If you attempt to use -vf extrafield or -af extrafield on a WAV audio file, FFmpeg will return an error because the filter is incompatible with audio streams. To manipulate the format header fields or extra metadata chunks of a WAV file, you must use the audio-specific methods detailed below.


1. Controlling the WAV Format Extension Field (cbSize)

Standard WAV files use the WAVEFORMATEX header, which contains an “extra” field specifying the size of extra format information (cbSize). For multi-channel or high-definition audio, FFmpeg uses WAVEFORMATEXTENSIBLE (which includes a 22-byte extra extension field).

You can control how FFmpeg writes these extra header fields using the -waveformat private muxer option:


2. Writing Broadcast Wave Format (BWF) Extra Chunks

WAV files often carry extra metadata in a Broadcast Wave Format (BWF) chunk, known as the bext chunk. You can enable and manipulate this extra metadata field using the -write_bext option.

Common BWF-specific metadata keys you can manipulate include: * description * originator * originator_reference * origination_date * origination_time * umid (Unique Material Identifier)


3. Adding, Editing, or Stripping General WAV Metadata Chunks

To edit standard metadata fields (like Title, Artist, or Genre) stored inside the WAV list info chunk, use the -metadata flag: