FFmpeg has a free-form command line option that allows the user to specify key/value pairs for encoding metadata. The option is
-metadata
and is used as such:
Whether the metadata key/value pairs are actually encoded into the output file is dependent upon the file format being muxed. Many formats only support a handful of metadata keys. This page documents which keys FFmpeg will encode into which formats.
QuickTime/MOV/MP4/M4A/et al.
The following table shows the metadata keys that FFmpeg honors when muxing a QuickTime file. The low-level identifier column lists the atom name that the format uses to encode the data on disc, which is not interesting to most readers. For the interested but uninitiated, the notation, e.g., '\251nam' indicates a 4-byte code consisting of the byte A9 in hexadecimal (or 251 in octal) followed by the ASCII characters 'n', 'a', and 'm'.
iTunes field
Low-level identifier
"title"
'\251nam'
"author"
Artist
'\251ART'
"album_artist"
Album Artist
'aART'
"album"
Album
'\251alb'
"grouping"
Grouping
'\251grp'
"composer"
Composer
'\251wrt'
"year"
'\251day'
"track"
Track Number
'trkn'
"comment"
Comments
'\251cmt'
"genre"
Genre
'\251gen'
"copyright"
'\251cpy'
"description"
Description
'desc'
"synopsis"
Information dialog when selecting "Show Description" in context menu
'ldes'
"show"
'tvsh'
"episode_id"
Episode ID
'tven'
"network"
'tvnn'
"lyrics"
Lyrics
'\251lyr'
Further, the MOV muxer encodes libavformat version string into the '\251too' field. FFmpeg does not allow this key to be overridden from the command line.
ASF/WMV/WMA
FFmpeg’s ASF muxer honors the following metadata keys:
“title”
“author”
“copyright”
“comment”
"rating"
Beyond these keys, the ASF muxer accepts free-form key/value metadata keys to be encoded into the header. Further, libavformat encodes its version using the key "WM/EncodingSettings".
FFmpeg’s AVI muxer honors the following metadata keys, writing them into FourCC chunks in the file header:
"IARL"
"IART", "artist"
"ICMS"
"ICMT", "comment"
"ICOP", "copyright"
"ICRD", "date"
"ICRP"
"IDIM"
"IDPI"
"IENG"
"IGNR", "genre"
"IKEY"
"ILGT"
"ILNG", "language"
"IMED"
"INAM", "title"
"IPLT"
"IPRD", "album"
"IPRT", "track"
"ISBJ"
"ISFT", "encoder" - note that this is automatically filled in by libavformat
"ISHP"
"ISRC"
"ISRF"
"ITCH", "encoded_by"
FFmpeg's FLV muxer generates an onMetaData tag when creating a FLV file. This tag may contain free-form metadata key/value pairs. These key/value pairs are presented to the Adobe Flash Player through the onMetaData event when loading the FLV.
In addition to user-specified key/value metadata pairs, FFmpeg's FLV muxer also encodes the following metadata fields:
'duration'
'filesize'
'encoder'
if video is present in FLV:
'width'
'height'
'videodatarate'
'framerate'
'videocodecid'
if audio is present in FLV:
'audiodatarate'
'audiosamplerate'
'audiosamplesize'
'stereo'
'audiocodecid'
Matroska
FFmpeg's Matroska muxer honors the following metadata keys:
“title”
“description”
“language”
Beyond these keys, the Matroska muxer also accepts free-form key/value metadata pairs.
FFmpeg's MP3 muxer creates an ID3v2 tag compatible with either v2.3 or v2.4. The muxer honors the following metadata keys:
Ffmpeg metadata tag
ID3v2.2
ID3v2.3
ID3v2.4
album
composer
genre
copyright
encoded_by
title
language
artist
album_artist
performer
publisher
track
encoder
lyrics
compilation
If any additional metadata tags are specified that are not in the preceding table, the FFmpeg MP3 muxer encodes a TXXX user-defined information frame containing both the key and the value.
MPEG Transport Streams
FFmpeg's transport stream muxer honors the following metadata keys:
"title"
"language"
FFmpeg’s NUT muxer honors the following metadata keys:
“title”
“author”
“copyright”
Realmedia
FFmpeg’s Realmedia muxer encodes a “CONT” chunk by concatenating certain metadata values specified on the command line. These are the recognized metadata keys:
“title”
“author”
“copyright”
“comment”
Example:
ffmpeg -i track05.wav \
-metadata title="This is the title" \
-metadata author="Made by Me" \
-metadata comment="An exercise in Realmedia metadata" \
-y track05.rm
This is what the start of the file looks like in a hex editor: