[FFmpeg-user] Is this a video file?
frafart at free.fr
frafart at free.fr
Fri Feb 28 19:11:11 CET 2014
Hello,
> How was our correspondent supposed to know that "file" even has a
> "--mime-type" argument, or for that matter what it would be called?
man file ?
To find if a file have a video stream :
$ ffmpeg -i /mnt/.../test.mp4 |& grep Stream
Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 512x288, 745 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 127 kb/s
$ ffmpeg -i /mnt/.../test.m4a |& grep Stream
Stream #0:0(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s
$
And you could automatize :
find . -type f | while read file; do file --mime-type ${file} | grep -qi 'video/' && ( videoStream=$(ffmpeg -i ${file} |& grep -E 'Stream.*Video') ; echo ${file} : ${videoStream}); done
You'll have file and stream information (event if ffmpeg don't find a video stream).
Regards,
Fabrice.
More information about the ffmpeg-user
mailing list