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.
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 would 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!