Adding Metadata

Table of contents
  1. Adding Metadata
    1. Querying metadata with ffprobe
    2. Adding Metadata to movie files
      1. MKV
      2. MXF
      3. MP4/mov
    3. Common metadata values for VFX

The more metadata we can store with the movie files, the better, there is nothing worse than losing a sidecar file that contains critical information. If the reviewer is loading the original file, then it should be easy with OpenRV to view the associated metadata.

OpenRV was modified to show any arbitrary metadata in movie files see PR - https://github.com/AcademySoftwareFoundation/OpenRV/pull/504

We cover how to add metadata to

We also suggest a list of common metadata attributes that would be useful in VFX movie containers.

It’s also worth looking at Editorial Workflow for information about adding timecode, which can help with frame numbers.

Querying metadata with ffprobe

ffprobe -v quiet -print_format json -show_format -show_streams \
        chimera_cars_srgb-test_mov-mjpeg_metadata.mxf

Adding Metadata to movie files

Depending on the movie file, there are a variety of mechanisms for embedding key-value metadata into movie files.

MKV

Mkv is the most flexible for adding arbitrary key-value strings to the file, all values are preserved and viewable by OpenRV.

ffmpeg -i input.mp4 -metadata my_custom_key="my value" -c copy output.mkv

MXF

ffmpeg can add some custom metadata to MXF files, but with important limitations:

  • Standard metadata fields (like material_package_name) can be set and will persist in the output MXF file.
  • Arbitrary custom metadata fields (such as project, artist, etc.) specified with -metadata key=value will not generally be written into the MXF file in a way that survives a subsequent ffprobe or ffmpeg read—except for a specific workaround.
  • Workaround: If you use the comment_prefix for your custom metadata keys (e.g., -metadata comment_project=”TEST PROJECT”), ffmpeg will write these as user comments in the MXF file. This method requires at least ffmpeg 4.2 and works for the mxf and mxf_opatom formats, but not for mxf_d10 (see this Stack Overflow answer).

Other metadata strings used include:

  • company_name
  • product_name
  • product_version

Example Command

ffmpeg -i input.mp4 -metadata comment_project="Test Project" -metadata comment_artist="Artist" \
            -metadata material_package_name="Test Clip" -f mxf output.mxf

MP4/mov

By default, MP4 and MOV only support a limited set of standard metadata fields:

  • title
  • artist
  • album
  • genre
  • year
  • comment
  • copyright
  • encoder
  • track
  • album_artist
  • composer
  • description
  • creation_time
  • publisher

To add arbitrary/custom metadata keys, use the -movflags use_metadata_tags option. This writes your custom fields into the mdta atom, which ffmpeg and ffprobe and OpenRV can read, but most standard players (like QuickTime) will ignore these fields.

ffmpeg -i input.mp4 -movflags use_metadata_tags \
    -metadata my_custom_key="my value" -c copy output.mp4

You can also use this flag to transcode media and keep the metadata:

ffmpeg -i input.mp4 -movflags use_metadata_tags -crf 22 output.mp4

Common metadata values for VFX

Below are suggestions for common metadata fields:

Field Type Description
first_frame, last_frame int Encoding to movie files typically loses the start frame, making it a pain to identify which frame you are looking at. This can be done with timecode, although you do sometimes need both. See Editorial Workflow
source_filename string Something to track where the encoded media came from.
source_id string Unique ID from vendor creating content. - This could be using: https://proto.school/content-addressing/04
source_frame_rate float If you are reviewing a proxy, but still want to remap back to the source frame, knowing the source frame rate is required. Useful for high-frame-rate media, e.g. 120 fps. Open questions: whether this is needed as well as the last frame, and whether a string would handle rates such as 59.94 better.
image_active_area xMin, yMin, xMax, yMax The bounding box of the picture location within the image. This is used in cases where the image is a re-processed version of the source frame, e.g. where a 2.35 aspect ratio picture has been padded to HD (perhaps time-code is burnt in, etc), this would allow any annotations to be always defined relative to the source frames, so would be able to be correctly overlayed on top.
watermarking string Document what sort of watermarking has been applied? - invisible, burnin?
slate_length int Duration of slate length (0 if no slate).
display_type enum Stereo left/right Stereo top/bottom Long/Lat VR mono Long/Lat VR Stereo top/bottom NOTE: This should be based on existing standards, e.g. https://github.com/google/spatial-media/tree/master/spatialmedia
task string Taskname if known.
date_authored string The latest date of the original authored content. This would be carried through any transcoding, so we don’t end up with the transcoded timestamps.
colorInteropID string This is mainly for exr file currently, but the hope is that this field would be used elsewhere, see ColorInterOP

This was originally defined in the Playback and Review Standards documentation


Copyright © 2022 ORI Contributors. Distributed under a CC BY 4.0 license.

This site uses Just the Docs, a documentation theme for Jekyll.