How to get and change video metadata in Linux

Video metadata contains information like author, title, genre, comment, and creation date. This information is embedded in the video file itself, but it not really a common practice for video releases to contain a lot of metadata info. If nothing else, there is usually some copyright information. In this tutorial, you will see how to get and change video metadata on a Linux system. This can be accomplished from both command line and GUI. We will cover both methods below.

In this tutorial you will learn:

  • How to get and change video metadata from GUI
  • How to get and change video metadata from command line
How to get and change video metadata in Linux
How to get and change video metadata in Linux
Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Any Linux distro
Software VLC, ExifTool
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

How to get and change video metadata from GUI




Many video player and editors should have the ability to get and change metadata of video files. One such example is the VLC media player, which is available for free on Linux.

  1. First step is to install VLC with your system’s package manager:
    Ubuntu, Debian, and Linux Mint:
    $ sudo apt install vlc
    
    Fedora:
    $ sudo dnf install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm 
    $ sudo dnf install vlc
    
    Arch Linux and Manjaro:
    $ sudo pacman -S vlc
    
  2. Open up your video file in VLC. In VLC, navigate to Tools > Media Information. Alternatively, you can use the Ctrl + I shortcut on your keyboard.
    Open media information in VLC media player
    Open media information in VLC media player
  3. Under the General tab, you will see all of the metadata for your video file.
    Viewing video metadata in VLC media player
    Viewing video metadata in VLC media player
  4. If you want to change any of this metadata, just make your edits in this window, then press OK to save it. The new metadata will be written to the video file. To remove the metadata, just backspace the contents here and press OK.
  5. You can find any additional metata for the file under the Metadata tab.
    Additional information under the Metadata tab
    Additional information under the Metadata tab

How to get and change video metadata from command line




ExifTool is a command like program which can get and change video metadata. You can use the appropriate command below to install ExifTool with your system’s package manager.

To install ExifTool on Ubuntu, Debian, and Linux Mint:

$ sudo apt install libimage-exiftool-perl

To install ExifTool on Fedora, CentOS, AlmaLinux, and Red Hat:

$ sudo dnf install perl-Image-ExifTool

To install ExifTool on Arch Linux and Manjaro:

$ sudo pacman -S perl-image-exiftool
  1. To view all of the metadata for a video file, use the exiftool command and specify the name of your video file.
    $ exiftool video.mp4
    
    Viewing video file metadata using ExitTool command
    Viewing video file metadata using ExitTool command
  2. To get a specific piece of metadata, such as the author, specify the option in your command:
    $ exiftool -comment video.mp4
    Comment                         : Thank you for downloading our sample mp4 video.
    
  3. To change the metadata for a field, use the following command syntax. This will change the Author field.
    $ exiftool -Author="linuxconfig" video.mp4
        1 image files updated
    

    The output says an image file has been updated, since ExifTool is primarily used to work with images, but do not worry, it will also make changes to the video file.

  4. To clear the metadata for a field, just overwrite it with empty data. Here is how we would delete the Comment field.
    $ exiftool -Comment= video.mp4 
        1 image files updated
    
  5. To clear the metadata for all fields in the video file, use the following syntax.
    $ exiftool -all= video.mp4
    



Closing Thoughts

In this tutorial, we saw how to get and change video metadata on a Linux system. This included a GUI method with VLC Media Player and a command line method with ExifTool. Filling out metadata is not a very common practice on video files, so you may often find these fields empty. Still, it can be a good way to attach important information to the file.



Comments and Discussions
Linux Forum