FFmpeg is a powerful command-line tool used for handling multimedia files, including editing metadata, which contains essential information such as title, artist, album, genre, creation date, and encoding details.

Modifying metadata is useful for organizing media libraries, improving searchability, and adding copyright or author details to media files.

This guide explains how to modify media metadata using FFmpeg with practical examples in Linux.

Understanding Media Metadata

Metadata in media files is stored in containers such as MP4, MKV, MP3, and FLAC.

These metadata fields include:

  • Title – Name of the media file.
  • Artist – Creator of the file.
  • Album – Album name (for audio files).
  • Genre – Category of the media.
  • Year – Release or creation date.
  • Comment – Additional information.
  • Copyright – Ownership details.

FFmpeg allows you to edit metadata without re-encoding the media, making the process fast and efficient.

Checking Metadata of a Media File

Before modifying metadata, check the existing metadata of media file using the following command, the option -hide_banner remove the version details.

ffmpeg -hide_banner -i planetearth.mp4
Check Metadata of Media File
Check the Metadata of Media File

Updating Metadata in Audio/Video Files

To modify metadata fields of audio files such as title, artist, album, or genre, use:

ffmpeg -i awesome.mp3 -metadata title="New Title" -metadata artist="New Artist" -metadata album="New Album" -metadata genre="Rock" -codec copy awesome-output.mp3

For video files, use a similar command:

ffmpeg -i input.mp4 -metadata title="My Video" -metadata author="John Doe" -codec copy output.mp4

Here:

  • -metadata title="New Title" updates the title.
  • -metadata artist="New Artist" changes the artist’s name.
  • -metadata album="New Album" modifies the album name.
  • -metadata genre="Rock" sets the genre.
  • -codec copy prevents re-encoding, making the process lossless.
Updating Metadata of Media File
Updating Metadata of Media File

To add or modify the description of a file, use:

ffmpeg -i input.mp4 -metadata comment="This is a sample video" -codec copy output.mp4

To add copyright details to a media file:

ffmpeg -i input.mp4 -metadata copyright="© 2025 Your Name" -codec copy output.mp4

You can add an album cover to MP3 or FLAC files:

ffmpeg -i input.mp3 -i cover.jpg -map 0 -map 1 -metadata:s:v title="Album Cover" -metadata:s:v comment="Cover Image" -codec copy output.mp3

You can extract metadata and save it as a text file.

ffmpeg -i input.mp4 -f ffmetadata metadata.txt

To modify the metadata, edit metadata.txt and then apply it to a file:

ffmpeg -i input.mp4 -i metadata.txt -map_metadata 1 -codec copy output.mp4

Removing Metadata from Media Files

To completely remove all metadata from a media file:

ffmpeg -i input.mp4 -map_metadata -1 -codec copy output.mp4

For audio files:

ffmpeg -i input.mp3 -map_metadata -1 -codec copy output.mp3
Conclusion

FFmpeg provides a simple yet powerful way to modify media metadata without re-encoding files. Whether you’re updating titles, adding copyright information, embedding album art, or removing metadata, FFmpeg makes the process efficient.

Similar Posts