-
Notifications
You must be signed in to change notification settings - Fork 246
androidProbeMediaInfo
xinbaicheng edited this page Aug 4, 2016
·
9 revisions
此功能主要有类KSYProbeMediaInfo实现
探测视频,可得到该视频的文件封装格式、视频编码格式、视频宽高、音频编码格式、采样率、声道数等信息
v1.4.4 及以上
支持多线程同时探测多个视频
KSYProbeMediaInfo probeMediaInfo = new KSYProbeMediaInfo();
String url = "rtmp://live.hkstv.hk.lxdns.com/live/hks";
int probeTimeOutSecond = 10; // 超时阈值,单位为秒
// 探测视频信息
probeMediaInfo.probeMediaInfo(url, probeTimeOutSecond);
Log.e(TAG, "Media format:"+probeMediaInfo.getMediaFormat().toString()+", bitrate:"+probeMediaInfo.getMediaBitrate() +", video stream count:"+probeMediaInfo.getVideoStreamCount() + ", audio stream count:"+probeMediaInfo.getAudioStreamCount());
ArrayList<KSYProbeMediaInfo.KSYProbeMediaData> videoArray = probeMediaInfo.getVideoStreams();
for(KSYProbeMediaInfo.KSYProbeMediaData video : videoArray)
{
Log.e(TAG, "Video codec type:"+video.getVideoCodecType().toString() + ",width:"+video.getVideoWidth()+", height:"+video.getVideoHeight());
}
ArrayList<KSYProbeMediaInfo.KSYProbeMediaData> audioArray = probeMediaInfo.getAudioStreams();
for(KSYProbeMediaInfo.KSYProbeMediaData audio : audioArray)
{
Log.e(TAG, "Audio codec type:"+audio.getAudioCodecType().toString()+", channel:"+audio.getAudioChannel()+", sample rate:"+audio.getAudioSampleRate());
Log.e(TAG, "Audio bitrate:"+audio.getAudioBitrate()+", frame size:"+audio.getAudioFrameSize()+", fmt:"+audio.getAudioFormat());
}