Imported Debian version 2.4.3~trusty1
[deb_ffmpeg.git] / ffmpeg / doc / metadata.texi
CommitLineData
2ba45a60
DM
1@chapter Metadata
2@c man begin METADATA
3
4FFmpeg is able to dump metadata from media files into a simple UTF-8-encoded
5INI-like text file and then load it back using the metadata muxer/demuxer.
6
7The file format is as follows:
8@enumerate
9
10@item
11A file consists of a header and a number of metadata tags divided into sections,
12each on its own line.
13
14@item
15The header is a ';FFMETADATA' string, followed by a version number (now 1).
16
17@item
18Metadata tags are of the form 'key=value'
19
20@item
21Immediately after header follows global metadata
22
23@item
24After global metadata there may be sections with per-stream/per-chapter
25metadata.
26
27@item
28A section starts with the section name in uppercase (i.e. STREAM or CHAPTER) in
29brackets ('[', ']') and ends with next section or end of file.
30
31@item
32At the beginning of a chapter section there may be an optional timebase to be
33used for start/end values. It must be in form 'TIMEBASE=num/den', where num and
34den are integers. If the timebase is missing then start/end times are assumed to
35be in milliseconds.
36Next a chapter section must contain chapter start and end times in form
37'START=num', 'END=num', where num is a positive integer.
38
39@item
40Empty lines and lines starting with ';' or '#' are ignored.
41
42@item
43Metadata keys or values containing special characters ('=', ';', '#', '\' and a
44newline) must be escaped with a backslash '\'.
45
46@item
47Note that whitespace in metadata (e.g. foo = bar) is considered to be a part of
48the tag (in the example above key is 'foo ', value is ' bar').
49@end enumerate
50
51A ffmetadata file might look like this:
52@example
53;FFMETADATA1
54title=bike\\shed
55;this is a comment
56artist=FFmpeg troll team
57
58[CHAPTER]
59TIMEBASE=1/1000
60START=0
61#chapter ends at 0:01:00
62END=60000
63title=chapter \#1
64[STREAM]
65title=multi\
66line
67@end example
68
69By using the ffmetadata muxer and demuxer it is possible to extract
70metadata from an input file to an ffmetadata file, and then transcode
71the file into an output file with the edited ffmetadata file.
72
73Extracting an ffmetadata file with @file{ffmpeg} goes as follows:
74@example
75ffmpeg -i INPUT -f ffmetadata FFMETADATAFILE
76@end example
77
78Reinserting edited metadata information from the FFMETADATAFILE file can
79be done as:
80@example
81ffmpeg -i INPUT -i FFMETADATAFILE -map_metadata 1 -codec copy OUTPUT
82@end example
83
84@c man end METADATA