2024-01-20 18:19:23 +00:00
|
|
|
@anchor{metadata}
|
2010-12-27 07:46:49 +00:00
|
|
|
@chapter Metadata
|
|
|
|
@c man begin METADATA
|
|
|
|
|
2011-03-17 15:55:58 +00:00
|
|
|
FFmpeg is able to dump metadata from media files into a simple UTF-8-encoded
|
2010-12-27 07:46:49 +00:00
|
|
|
INI-like text file and then load it back using the metadata muxer/demuxer.
|
|
|
|
|
|
|
|
The file format is as follows:
|
|
|
|
@enumerate
|
|
|
|
|
|
|
|
@item
|
|
|
|
A file consists of a header and a number of metadata tags divided into sections,
|
|
|
|
each on its own line.
|
|
|
|
|
|
|
|
@item
|
2015-03-23 03:47:18 +00:00
|
|
|
The header is a @samp{;FFMETADATA} string, followed by a version number (now 1).
|
2010-12-27 07:46:49 +00:00
|
|
|
|
|
|
|
@item
|
2015-03-23 03:47:18 +00:00
|
|
|
Metadata tags are of the form @samp{key=value}
|
2010-12-27 07:46:49 +00:00
|
|
|
|
|
|
|
@item
|
|
|
|
Immediately after header follows global metadata
|
|
|
|
|
|
|
|
@item
|
|
|
|
After global metadata there may be sections with per-stream/per-chapter
|
|
|
|
metadata.
|
|
|
|
|
|
|
|
@item
|
|
|
|
A section starts with the section name in uppercase (i.e. STREAM or CHAPTER) in
|
2015-03-23 03:47:18 +00:00
|
|
|
brackets (@samp{[}, @samp{]}) and ends with next section or end of file.
|
2010-12-27 07:46:49 +00:00
|
|
|
|
|
|
|
@item
|
|
|
|
At the beginning of a chapter section there may be an optional timebase to be
|
2015-03-23 03:47:18 +00:00
|
|
|
used for start/end values. It must be in form
|
|
|
|
@samp{TIMEBASE=@var{num}/@var{den}}, where @var{num} and @var{den} are
|
|
|
|
integers. If the timebase is missing then start/end times are assumed to
|
2018-12-14 11:56:13 +00:00
|
|
|
be in nanoseconds.
|
2015-03-23 03:47:18 +00:00
|
|
|
|
2010-12-27 07:46:49 +00:00
|
|
|
Next a chapter section must contain chapter start and end times in form
|
2015-03-23 03:47:18 +00:00
|
|
|
@samp{START=@var{num}}, @samp{END=@var{num}}, where @var{num} is a positive
|
|
|
|
integer.
|
2010-12-27 07:46:49 +00:00
|
|
|
|
|
|
|
@item
|
2015-03-23 03:47:18 +00:00
|
|
|
Empty lines and lines starting with @samp{;} or @samp{#} are ignored.
|
2010-12-27 07:46:49 +00:00
|
|
|
|
|
|
|
@item
|
2015-03-23 03:47:18 +00:00
|
|
|
Metadata keys or values containing special characters (@samp{=}, @samp{;},
|
|
|
|
@samp{#}, @samp{\} and a newline) must be escaped with a backslash @samp{\}.
|
2010-12-27 07:46:49 +00:00
|
|
|
|
|
|
|
@item
|
2015-03-23 03:47:18 +00:00
|
|
|
Note that whitespace in metadata (e.g. @samp{foo = bar}) is considered to be
|
|
|
|
a part of the tag (in the example above key is @samp{foo }, value is
|
|
|
|
@samp{ bar}).
|
2010-12-27 07:46:49 +00:00
|
|
|
@end enumerate
|
|
|
|
|
|
|
|
A ffmetadata file might look like this:
|
|
|
|
@example
|
|
|
|
;FFMETADATA1
|
|
|
|
title=bike\\shed
|
|
|
|
;this is a comment
|
2011-03-17 15:55:58 +00:00
|
|
|
artist=FFmpeg troll team
|
2010-12-27 07:46:49 +00:00
|
|
|
|
|
|
|
[CHAPTER]
|
|
|
|
TIMEBASE=1/1000
|
|
|
|
START=0
|
|
|
|
#chapter ends at 0:01:00
|
|
|
|
END=60000
|
|
|
|
title=chapter \#1
|
|
|
|
[STREAM]
|
|
|
|
title=multi\
|
|
|
|
line
|
|
|
|
@end example
|
2011-04-15 14:14:22 +00:00
|
|
|
|
|
|
|
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 @file{ffmpeg} goes as follows:
|
|
|
|
@example
|
|
|
|
ffmpeg -i INPUT -f ffmetadata FFMETADATAFILE
|
|
|
|
@end example
|
|
|
|
|
|
|
|
Reinserting edited metadata information from the FFMETADATAFILE file can
|
|
|
|
be done as:
|
|
|
|
@example
|
|
|
|
ffmpeg -i INPUT -i FFMETADATAFILE -map_metadata 1 -codec copy OUTPUT
|
|
|
|
@end example
|
|
|
|
|
2010-12-27 07:46:49 +00:00
|
|
|
@c man end METADATA
|