简体   繁体   English

ffprobe / ffmpeg:知道输入是视频,图像还是音频

[英]ffprobe/ffmpeg: know if a input is a video, image or audio

I need to know if a input file is a Video, Audio or a Image file. 我需要知道输入文件是视频,音频还是图像文件。

Some of the audio files contains an video stream and a audio stream, so, I can't check the streams to know if it's a video or a audio. 一些音频文件包含视频流和音频流,因此,我无法检查这些流以了解它是视频还是音频。

Is there any way to know that? 有什么办法知道吗? Thanks. 谢谢。

I have used class File.extension to know the extension of the file like: 我已经使用File.extension类来了解文件的扩展名,例如:

if (f.extension == "jpg" || f.extension == "jpeg") {
 //image
}

It works for me. 这个对我有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM