How to Get Video Dimensions with FFmpeg

To get the dimensions of a video file with FFmpeg, probe the file using ffprobe.


Let's try a couple of examples to see how this works.


Getting the Width and Height

To get the width and height of a video, use the following command:


ffprobe -i sample_1.mp4 -v quiet -show_entries stream=width,height -hide_banner


The stream=width,height argument tells FFprobe to only return width and height information.


Get the Width and Height Information in JSON Format

To get the width and height data in JSON format, set the value of the -print_format flag to json like this:


ffprobe -i sample_1.mp4 -v quiet -print_format json -show_entries stream=width,height -hide_banner
 "programs": [

 "streams": [
     "width": 1280,
     "height": 720