I am trying to figure out if a certain user-uploaded file is a video file.
I first tried ffprobe,
# a png file
Input #0, png_pipe, from '<file>':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: png, rgba(pc), 920x2094 [SAR 4724:4724 DAR 460:1047], 25 tbr, 25 tbn, 25 tbc
# a text file
Input #0, tty, from '<file>':
Duration: 00:00:00.24, bitrate: 40 kb/s
Stream #0:0: Video: ansi, pal8, 640x400, 25 fps, 25 tbr, 25 tbn, 25 tbc
# a video file
Input #0, matroska,webm, from '<file>':
Metadata:
encoder : libebml v1.3.5 + libmatroska v1.4.8
creation_time : 2017-12-12T20:18:42.000000Z
<redacted>
but it's too hard to figure out what's what. Even image files and text files count as a video.
Should I compare the output matroska,webm,
with every codec ffmpeg supports or is there a better way to do this?