Skip to content

Metadata preservation #1027

@mifi

Description

@mifi

There have been many requests for preserving metadata, or some metadata getting lost when exporting. In my experience it seems to happen more often in older or more obscure codecs. Some related issues:

Although it seems there is no silver bullet, I will gather and summarise challenges and possible options here.

Default ffmpeg -i mp4 -c copy out.mp4

This seems to copy only some metadata, like some timestamps (both global and per-track).

ffmpeg -map_metadata X

Where X is the file input index. Typically -map_metadata 0 for mapping metadata from the first input to the output.

LosslessCut uses this by default when cutting (also for merge, but only if keep original metadata when merging is enabled).

ffmpeg -movflags use_metadata_tags

If you enable the Preserve all MP4/MOV metadata, it will use this flag. This flag will make ffmpeg copy additional tags (for MOV/MP4 only). However it will copy them into a different location than the source file. Example tag shown in exiftool:

  • Original: MOV-Movie-UserData-Meta-ItemList:Comment: Test Comment
  • Output: MOV-Movie-UserData-Meta-Keys:Comment: Test Comment
  • Original: MOV-Movie-UserData-Meta-ItemList-iTunesInfo:CUSTOM1: Old File Name
  • Output: MOV-Movie-UserData-Meta-Keys:CUSTOM1: Old File Name

See #853 (comment)

Problems:

Copy tags with exiftool

See branch https://github.com/mifi/lossless-cut/tree/exiftool-integration

Although not yet implemented in LosslessCut (feb 2022), this command will copy some more useful metadata than -movflags use_metadata_tags, for example:

However, exiftool will also skip some tags that ffmpeg -movflags use_metadata_tags will copy:

Here is the command:

exiftool -tagsFromFile original.mp4 -all:all -overwrite_original with-exiftool.mp4

Exiftool can also give other benefits:

  • view/edit all exiftool metadata as strings
  • view and modify all dates
  • view gps data on a map
  • modify gps data
  • preserve some metadata that ffmpeg does not copy (but also lose some other metadata)
    • 360 spherical projection seems to be preserved
    • gps preserved?
  • option to export all exiftool metadata to separate file?
  • set "encoder" meta to "lavf-xx/LosslessCut" (currently hardcoded by ffmpeg and not possible to override)

See also #2096

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions