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
and 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
& ffprobe
would be kind enough to assist me with finding the other values I need in a more straightforward way than the crazy code I'm using myself, created 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:\>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