-
Notifications
You must be signed in to change notification settings - Fork 146
prober
shixuemei edited this page Sep 28, 2016
·
12 revisions
- 无需启动播放即可得到文件的音视频信息描述,如文件封装格式、视频编码格式、视频宽高、音频编码格式、采样率、声道数等信息
- 获取本地缩略图,可设定输出缩略图的宽高以及所需具体时间点的缩略图
- 探测音视频信息: v1.5.3 及以上
- 获取缩略图: v1.8.2 及以上
- 此功能由类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);
}
}
备注:v1.8.2.0版本要求缩略图的宽高参数必须大于0
NSURL *url = [NSURL URLWithString:@"http://maichang.kssws.ks-cdn.com/upload20150716161913.mp4"];
KSYMediaInfoProber *prober = [[KSYMediaInfoProber alloc] initWithContentURL: url];
UIImage *thumbnailImage = [prober getVideoThumbnailImageAtTime:0 width:640 height:480];