1
有沒有一種方法可以模糊在AVPlayerLayer中顯示的內容?
內容是流的資產(M3U8),所以沒有選項AVAssetReader等AVPlayerLayer的模糊內容
有沒有一種方法可以模糊在AVPlayerLayer中顯示的內容?
內容是流的資產(M3U8),所以沒有選項AVAssetReader等AVPlayerLayer的模糊內容
嘗試使用下一個解決方案來獲得圖像:
CIImage *snaphotImage = nil;
AVPlayerItem *item = ((AVPlayerLayer*)view.layer).player.currentItem;
if (item.status == AVPlayerItemStatusReadyToPlay)
{
AVURLAsset *asset = (AVURLAsset *)item.asset;
AVAssetImageGenerator *imageGenerator = [[AVAssetImageGenerator alloc] initWithAsset:asset];
CGImageRef thumb = [imageGenerator copyCGImageAtTime:((AVPlayerLayer*)view.layer).player.currentTime
actualTime:NULL
error:NULL];
snapshotImage = [CIImage imageWithCGImage:thumb];
CGImageRelease(thumb);
}
,然後應用模糊它:
CIFilter *filter = [CIFilter filterWithName:@"CIGaussianBlur"
keysAndValues:@"inputRadius", @9.0,
@"inputImage", snapshotImage, nil];
CIImage *resultImage = [filter outputImage];
UIImage *resultUIImage = [UIImage imageWithCIImage:resultImage];
這並不回答這個問題。簡單地模糊視頻的單個快照。 – arielyz 2015-02-04 15:59:32