How to use ffprobe to obtain certain information about mp4/h.264 files I am but a lowly PHP developer that has been tasked with retrieving some basic information about 100's of thousands of video files.  I've had some luck using ffmpeg extracting the video bitrate, video width, video height, duration, and aspect ratio from them, but with an error ratio of about 5%, this still leaves me with an enormous number of files that I don't know how to deal with.  The videos DO play,
but the massive amount of data that ffmpeg returns in has me baffled as to how parse the returned XML to find what I need with all the conditions that I seem to be encountering.  (The files are a collection from the past 15 years or so, some newly encoded, others converted years ago)

At any rate, I found the following use of ffprobe to get duration, and was hoping that someone here who understands the complexities of using ffmpeg &amp; ffprobe would be kind enough in assist me with finding the other values I need in a more straightforward way than the crazy code I'm finding myself creating to climb through the full results of ffmpeg.

ffprobe -i "video.mp4" -show_entries format=duration -v quiet -of csv="p=0"

Thanks so very much in advance.

CLARIFICATION:

I should add that with the below cmd, I can "see" what I need, but I don't understand how to extract what I need, e.g. retrieving the VIDEO bitrate, and suppressing/ignoring the AUDIO bitrate, or determining which of 2 different durations to use (Audio/Video durations?)

C:\&gt;ffprobe -v error -show_entries stream=width,height,bit_rate,duration -of default=noprint_wrappers=1 input.mp4

duration=1712.000000
bit_rate=64000
width=320
height=240
duration=1711.946113
bit_rate=359827
duration=1712.000000
bit_rate=N/A
duration=1712.000000
bit_rate=N/A
If you only want the information from the first video stream use -select_streams v:0:

ffprobe -v error -select_streams v:0 -show_entries stream=width,height,duration,bit_rate -of default=noprint_wrappers=1 input.mp4


Example output:

width=640
height=480
duration=10.000000
bit_rate=942704



To see a list all entries use -show_streams and/or -show_format instead of -show_entries.
See FFprobe Documentation: Writers for various output formatting styles.
See FFmpeg Wiki: FFprobe for more examples.