-
Notifications
You must be signed in to change notification settings - Fork 146
prober
shixuemei edited this page Sep 21, 2016
·
12 revisions
无需启动播放即可得到文件的音视频信息描述,如文件封装格式、视频编码格式、视频宽高、音频编码格式、采样率、声道数等信息
- 此功能由类KSYMediaInfoProber实现
- 文件格式描述信息定义为KSYMediaInfo
- 支持的封装格式定义为MEDIAINFO_MUX_TYPE
- 支持的音视频格式定义为MEDIAINFO_CODEC_ID
- 支持一个对象进行多次文件探测
NSURL *url = [NSURL URLWithString:@"http://maichang.kssws.ks-cdn.com/upload20150716161913.mp4"];
KSYMediaInfoProber *prober = [[KSYMediaInfoProber alloc] initWithContentURL: url];
KSYMediaInfo *mediaInfo = prober.ksyMediaInfo;
if(mediaInfo)
{
NSLog(@"mux type:%d", mediaInfo.type);
NSLog(@"bitrate:%lld", mediaInfo.bitrate);
for (KSYVideoInfo *videoInfo in mediaInfo.videos) {
NSLog(@"video codec:%d", videoInfo.vcodec);
NSLog(@"video frame width:%d", videoInfo.frame_width);
NSLog(@"video frame height:%d", videoInfo.frame_height);
}
for(KSYAudioInfo *audioInfo in mediaInfo.audios)
{
NSLog(@"audio codec:%d", audioInfo.acodec);
NSLog(@"audio language:%@", audioInfo.language);
NSLog(@"audio bitrate:%lld", audioInfo.bitrate);
NSLog(@"audio channels:%d", audioInfo.channels);
NSLog(@"audio frame_size:%d", audioInfo.framesize);
NSLog(@"audio sample_format:%d", audioInfo.sample_format);
NSLog(@"audio samplerate:%d", audioInfo.samplerate);
}
}