Display Video Metadata on Screen with FFmpeg

This article demonstrates how to extract and display custom metadata values, such as a video’s title or creation date, directly on the video screen using FFmpeg. By utilizing the drawtext video filter alongside FFmpeg’s text expansion feature, you can dynamically overlay metadata onto your video frames during the rendering process.

Step 1: Ensure Your Video Has Metadata

Before displaying metadata, the input file must contain the tags you want to read. You can embed custom metadata (like a title) into a video using the following command:

ffmpeg -i input.mp4 -metadata title="My Custom Video Title" -codec copy prepared.mp4

Step 2: Overlay the Metadata onto the Video

To burn the metadata onto the video frame, use the drawtext filter. FFmpeg can dynamically read metadata tags using the %{metadata\:key_name} syntax.

Run the following command to display the title:

ffmpeg -i prepared.mp4 -vf "drawtext=text='%{metadata\:title}':x=50:y=50:fontsize=24:fontcolor=white:box=1:boxcolor=black@0.5" -codec:a copy output.mp4

Parameter Breakdown

Displaying Multiple Metadata Fields

You can combine multiple metadata fields or add static label text within the same filter. For example, to display both the title and the creation time:

ffmpeg -i prepared.mp4 -vf "drawtext=text='Title\: %{metadata\:title} | Created\: %{metadata\:creation_time}':x=50:y=50:fontsize=20:fontcolor=white:box=1:boxcolor=black@0.5" -codec:a copy output.mp4