FFmpeg Metadata

From MultimediaWiki
Jump to: navigation, search

This page documents all of the metadata keys that FFmpeg honors, depending on the format being encoded.

Basic Usage

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:

 ffmpeg -i inputfile -metadata title="Movie Title" -metadata year="2010" outputfile

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'.

Key iTunes field Low-level identifier
"title" Name '\251nam'
"author" Artist '\251ART'
"album_artist" Album Artist 'aART'
"album" Album '\251alb'
"grouping" Grouping '\251grp'
"composer" Composer '\251wrt'
"year" 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" 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".

AVI

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"

FLV

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.

MP3

FFmpeg's mp3 muxer honors the following metadata keys:

  • “title”
  • “author”
  • “album”
  • “year”
  • “comment”
  • “track”
  • “genre”

MPEG Transport Streams

FFmpeg's transport stream muxer honors the following metadata keys:

  • "title"
  • "language"

NUT

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 copyright="Copyright 2009 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:

0040   00 01 00 03  43 4F 4E 54  00 00 00 5F  00 00 00 11  ....CONT..._....
0050   54 68 69 73  20 69 73 20  74 68 65 20  74 69 74 6C  This is the titl
0060   65 00 0A 4D  61 64 65 20  62 79 20 4D  65 00 11 43  e..Made by Me..C
0070   6F 70 79 72  69 67 68 74  20 32 30 30  39 20 4D 65  opyright 2009 Me
0080   00 21 41 6E  20 65 78 65  72 63 69 73  65 20 69 6E  .!An exercise in
0090   20 52 65 61  6C 6D 65 64  69 61 20 6D  65 74 61 64   Realmedia metad
00A0   61 74 61 4D  44 50 52 00  00 00 9B 00  00 00 00 00  ataMDPR.........

SDP

The SDP muxer honors the “title” metadata key.

SoX

The SoX native format muxer honors the “comment” metadata key.