Metadata
********

FFmpeg is able to dump metadata from media files into a simple UTF-8-encoded INI-like text file and then load it back using the metadata muxer/demuxer.

The file format is as follows:

 1. A file consists of a header and a number of metadata tags divided into sections, each on its own line.

 2. The header is a ;FFMETADATA string, followed by a version number (now 1).

 3. Metadata tags are of the form key=value

 4. Immediately after header follows global metadata

 5. After global metadata there may be sections with per-stream/per-chapter metadata.

 6. A section starts with the section name in uppercase (i.e. STREAM or CHAPTER) in brackets ([, ]) and ends with next section or end of file.

 7. At the beginning of a chapter section there may be an optional timebase to be used for start/end values. It must be in form TIMEBASE=NUM/DEN, where NUM and DEN are integers. If the timebase is missing then start/end times are assumed to be in nanoseconds.

     Next a chapter section must contain chapter start and end times in form START=NUM, END=NUM, where NUM is a positive integer.

 8. Empty lines and lines starting with ; or # are ignored.

 9. Metadata keys or values containing special characters (=, ;, #, \ and a newline) must be escaped with a backslash \.

 10. Note that whitespace in metadata (e.g. foo = bar) is considered to be a part of the tag (in the example above key is foo , value is bar).

A ffmetadata file might look like this:

     ;FFMETADATA1
     title=bike\\shed
     ;this is a comment
     artist=FFmpeg troll team

     [CHAPTER]
     TIMEBASE=1/1000
     START=0
     #chapter ends at 0:01:00
     END=60000
     title=chapter \#1
     [STREAM]
     title=multi\
     line

By using the ffmetadata muxer and demuxer it is possible to extract metadata from an input file to an ffmetadata file, and then transcode the file into an output file with the edited ffmetadata file.

Extracting an ffmetadata file with ffmpeg goes as follows:

     ffmpeg -i INPUT -f ffmetadata FFMETADATAFILE

Reinserting edited metadata information from the FFMETADATAFILE file can be done as:

     ffmpeg -i INPUT -i FFMETADATAFILE -map_metadata 1 -codec copy OUTPUT