How to get primary information like height, width, duration, fps, etc. for a video file using FFmpeg?

As a media content manager, it is my job to organize and maintain a sizable library of video assets. It is my responsibility to compile all of the pertinent data on every video, including its duration, frames per second (fps), resolution (height and width), and other pertinent information. To classify, organize, and get the content ready for other platforms, this information is essential.
Can someone from the community help me to get the primary information on video using FFmpeg?
Any help would be helpful.

FFmpeg provides a CLI utility called ffprobe which allows access to all the metadata related to media files (video/audio/subtitles). You can use -show_streams to get details about each individual stream in the video file. Output format option -of allows to display details in JSON/CSV/Plaint Text format.

1 Like

Can you elaborate more if possible can you provide the complete commands to get this information using ffprobe or any other idea?

You can use the following command using keys / variable names

ffprobe -v error -show_entries stream=width,height -of default=noprint_wrappers=1 input.mp4 width=1280 height=720

Secondly, if Just width x height

ffprobe -v error -select_streams v -show_entries stream=width,height -of csv=p=0:s=x input.m4v 1280x720

Hope it will be helpful for you in case you want to use JSON

ffprobe -v error -select_streams v -show_entries stream=width,height -of json input.mkv { "programs": [ ], "streams": [ { "width": 1280, "height": 720 } ] }

Let us know if you have further queries related to this!