拦截iOS上HTTP Live Streaming客户端中的视频帧

时间:2016-02-19 22:23:24

标签: ios iphone video http-live-streaming

在通过HTTP Live Streaming从服务器播放实时视频的iPhone应用程序中,解码后是否可以访问已解码的视频帧?

据我所知,createBufferStrategy()AVPlayerMPMoviePlayer似乎没有提供回调来通知应用已解码单个帧。

我的问题类似于“Record HTTP Live Streaming Video To File While Watching?”,除了我不一定对完整的DVR功能感兴趣。这里的一个答案表明服务器端解决方案,并且对于客户端解决方案的可能性含糊不清。它也类似于“Recording, Taking Snap Shot with HTTP Live streaming video running MPMoviePlayerController in iOS”,但我不需要使用CoreVideo的解决方案。

1 个答案:

答案 0 :(得分:1)

可以使用" AVPlayerItemVideoOutput"像这样:

NSDictionary *options = @{ (__bridge NSString *)kCVPixelBufferPixelFormatTypeKey : @(kCVPixelFormatType_32BGRA),
                           (__bridge NSString *)kCVPixelBufferOpenGLESCompatibilityKey : @YES };
myOutput = [[AVPlayerItemVideoOutput alloc] initWithPixelBufferAttributes:options];
myOutput.suppressesPlayerRendering = NO;
[myOutput requestNotificationOfMediaDataChangeWithAdvanceInterval:1];
[myOutput setDelegate:self queue:dispatch_get_main_queue()];
[playerItem addOutput:myOutput];

我已经在我的几个项目中完成了它。保重并祝你好运!

仅供参考:(AVPlayerItem *playerItem;)

/安德斯。

相关问题