Updating Video Metadata Based on Modified Date Using Exiftool

In this article, we’ll explore how to update the metadata of video files (in this case, MP4 files) based on their modified date using the powerful Exiftool command-line utility. Metadata can include various information about the video, such as creation date, author, and more. Sometimes, it’s necessary to adjust or correct this metadata. Here, we’ll focus on modifying the date-related metadata using Exiftool.

Prerequisites

Before you begin, make sure you have Exiftool installed on your system. You can download it from the official website: Exiftool

Updating Video Metadata

We’ll use a simple Bash loop to process all the MP4 files in a directory and update their metadata based on the modified date of the file. Here’s the script you provided:

1
2
3
4
for i in *.mp4; do
    echo "Processing $i"
    exiftool "-*date<filename" -wm w "$i"
done

Let’s break down what this script does:

  • The for loop iterates through all files in the current directory with the .mp4 extension.

  • Inside the loop, exiftool is used to update the metadata of each video file. The command "-*date<filename" copies the modified date of the file to various date-related metadata tags in the video file. -wm w writes the changes to the file.

  • The echo statement provides a simple progress update, displaying the name of the file being processed.

Viewing Modified Metadata

If you want to check the modified metadata of a specific video file (e.g., video-2010-11-13-16-20-31.mp4), you can use the following command:

1
exiftool -a -s -G1 -time:all video-2010-11-13-16-20-31.mp4

This command uses Exiftool to display all date-related metadata for the specified video file. Here’s what each option does:

  • -a: Processes all tags.
  • -s: Show tag names in a short format.
  • -G1: Display one tag group per line to make the output more readable.
  • -time:all: Shows all date-related metadata.

Conclusion

Exiftool is a versatile tool for managing metadata in various file types, including video files like MP4. By using the provided script, you can easily update the metadata of multiple video files based on their modified date. Additionally, the second command allows you to inspect the modified metadata for a specific video file, ensuring your changes were applied correctly.

0%