How to Check Video Files Formats in Linux

As a Linux user, knowing the video formats of the video files we are using for our projects or work is important for the swift performance and completion of the set project/work objectives.

The main reason for checking the video formats of video files in Linux; especially when handling them under a video editor software, depends on the ownership rights status that a software company may have on the video format in question.

[ You might also like: How to Create a Video From Images in Linux ]

Acknowledging such ownership statuses from these software companies saves you from having to pay unnecessary license fees in order to embrace full use of a video format for your work/project.

This article will walk us through valid approaches to determining the video formats of the video files at your disposal. You should in return know which video formats are not attached to the software license fee to freely use them for your work/project.

Problem Statement

Let us for instance assume we want to determine the video format of the following video file.

Python_Backend_Web_Development_Course.mp4

Please understand that while the above video file might have an .mp4 extension, we cannot be really sure of its video format unless we take a look at its comprehensive metadata output. We, therefore, need some Linux-bound tools to help us with this assignment.

Find Video Format Using ffmpeg Video Converter

The ffmpeg terminal-bound utility primarily functions as a rich video converter. Its manual page showcases its limitless command sequences one of them being its ability to retrieve the metadata associated with an input video file.

Make sure ffmpeg is installed on your Linux OS distribution.

Install ffmpeg in Linux

On RHEL-based distributions like RHEL 8, Rocky Linux, and AlmaLinux:

$ sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
$ sudo dnf upgrade
$ sudo subscription-manager repos --enable "rhel-*-optional-rpms" --enable "rhel-*-extras-rpms"
$ sudo yum update
$ sudo yum install snapd
$ sudo systemctl enable --now snapd.socket
$ sudo ln -s /var/lib/snapd/snap /snap
$ sudo snap install ffmpeg 

On Fedora Linux distribution:

$ sudo dnf makecache 
$ sudo dnf install ffmpeg-free

On Debian distributions like Ubuntu and Linux Mint:

$ sudo apt update && sudo apt upgrade -y
$ sudo apt install ffmpeg

On Arch Linux and Manjaro:

$ sudo pacman -Syu
$ sudo pacman -S ffmpeg

On openSUSE Leap:

$ sudo zypper refresh
$ sudo zypper install ffmpeg

On openSUSE Tumbleweed:

$ sudo zypper refresh
$ sudo zypper install ffmpeg-4

Check Video Format in Linux

To check the video format of the above-sampled video file using ffmpeg, we will simply run the command:

$ ffmpeg -i Python_Backend_Web_Development_Course.mp4

The command option -i points to the input file which succeeds it.

Find Video Format in Linux Using ffmpeg
Find Video Format in Linux Using ffmpeg

From the metadata info, we can confirm that we are indeed dealing with an mp4 video format.

Check Video Format Using ffprobe Tool

The ffprobe tool is installed alongside ffmpeg and primarily retrieves metadata information regarding an input media file.

$ ffprobe -i Python_Backend_Web_Development_Course.mp4
Find Video Format in Linux Using ffprobe
Find Video Format in Linux Using ffprobe

You can now check video formats of media files in Linux before using them for your work/project.

Got something to say? Join the discussion.

Have a question or suggestion? Please leave a comment to start the discussion. Please keep in mind that all comments are moderated and your email address will NOT be published.