Add Metadata Tags to WebM Using FFmpeg

This article provides a straightforward guide on how to insert metadata tags, such as “Title”, “Artist”, and custom fields, into a WebM video or audio container using the FFmpeg command-line tool. You will learn the exact commands needed to add, modify, and verify metadata without re-encoding your media.

The Basic Command Structure

To add metadata to a WebM file without re-encoding the video or audio streams, use the -metadata option combined with stream copying (-c copy). This process is nearly instantaneous because it only modifies the container header.

The basic syntax is:

ffmpeg -i input.webm -metadata key="value" -c copy output.webm

Adding Title and Artist Metadata

To write standard tags like “Title” and “Artist” into your WebM file, run the following command:

ffmpeg -i input.webm -metadata title="My Great Video" -metadata artist="John Doe" -c copy output.webm

In this command: * -i input.webm specifies your source file. * -metadata title="My Great Video" sets the title tag. * -metadata artist="John Doe" sets the artist tag. * -c copy tells FFmpeg to copy the audio and video streams directly without re-encoding them. * output.webm is the name of the new file containing the metadata.

Adding Custom or Common Metadata Tags

The WebM container (which is based on Matroska) supports a wide variety of metadata tags. You can chain multiple -metadata flags together to add as many tags as you need:

ffmpeg -i input.webm \
  -metadata title="Screencast Tutorial" \
  -metadata artist="Jane Doe" \
  -metadata date_released="2023-10-27" \
  -metadata description="A step-by-step guide to FFmpeg" \
  -metadata copyright="© 2023 Jane Doe" \
  -c copy output.webm

Verifying the Metadata

Once you have created the new WebM file, you can verify that the metadata tags were successfully written by using ffprobe (which is installed alongside FFmpeg):

ffprobe -show_entries format_tags output.webm

Alternatively, you can run a simple FFmpeg input check:

ffmpeg -i output.webm

The terminal output will display the metadata block near the top of the stream information, confirming that your “Title”, “Artist”, and other custom tags are properly embedded in the WebM container.