metadata.texi 2.4 KB

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