在 iOS 上的 HTTP Live Streaming 客户端中拦截视频帧
Intercepting video frames in an HTTP Live Streaming client on iOS
在通过 HTTP Live Streaming 从服务器播放实时视频的 iPhone 应用程序中,是否可以在解码后访问解码后的视频帧?
据我所知,AVPlayer
、MPMoviePlayer
和 CoreVideo
似乎没有提供回调来通知应用程序单个帧已被解码。
我的问题类似于“", except I'm not necessarily interested in full DVR functionality. The one answer there suggests a server-side solution and is vague about the possibility of a client-side solution. It's also similar to "”,只是我不需要解决方案即可使用 MPMoviePlayerController
。
可以这样使用 "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;)
/安德斯.
在通过 HTTP Live Streaming 从服务器播放实时视频的 iPhone 应用程序中,是否可以在解码后访问解码后的视频帧?
据我所知,AVPlayer
、MPMoviePlayer
和 CoreVideo
似乎没有提供回调来通知应用程序单个帧已被解码。
我的问题类似于“", except I'm not necessarily interested in full DVR functionality. The one answer there suggests a server-side solution and is vague about the possibility of a client-side solution. It's also similar to "”,只是我不需要解决方案即可使用 MPMoviePlayerController
。
可以这样使用 "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;)
/安德斯.