How to get width, height, sample aspect ratio of video with ffmpeg


ffmpeg-logo

You can use 2 methods:

ffprobe -v error -select_streams v:0 -show_entries stream=width,height,sample_aspect_ratio -of default=noprint_wrappers=1:nokey=1 "INPUT.mp4"
ffprobe -v error -select_streams v:0 -show_entries stream=width,height,sample_aspect_ratio -of csv "INPUT.mp4"

Example:

D:\tutorialspots>ffprobe -v error -select_streams v:0 -
show_entries stream=width,height,sample_aspect_ratio -of default=noprint_wrapper
s=1:nokey=1 "video_7.mp4"
1280
720
1:1

D:\tutorialspots>ffprobe -v error -select_streams v:0 -
show_entries stream=width,height,sample_aspect_ratio -of csv "video_7.mp4"
stream,1280,720,1:1

Leave a Reply