metadata.texi 2.3 KB

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