I have a directory with many files of different types and want to find out the codec of each video file. This works well with this command:
$ ffprobe -v error -select_streams v -show_entries stream=codec_name,codec_type -of default=noprint_wrappers=1 video-file
codec_name=hevc
codec_type=video
But unfortunately I also get a result for JPG and text files:
$ ffprobe -v error -select_streams v -show_entries stream=codec_name,codec_type -of default=noprint_wrappers=1 file.jpg
codec_name=mjpeg
codec_type=video
$ ffprobe -v error -select_streams v -show_entries stream=codec_name,codec_type -of default=noprint_wrappers=1 file.txt
codec_name=ansi
codec_type=video
Both files are clearly not video files. Well, I could filter out the file extensions or blacklist these codec names. But isn't there a proper way with ffprobe?