开发者

Playing a stream of video data using QTKit on Mac OS X

I've been playing with QTKit for a couple of days and I'm successfully able to record video data to a file from the camera using a QTCaptureSession and QTCaptureDeviceInput etc.

However what I want to do is send the data to another location, either over the network or to a different object within the same app (it doesn't matter) and then play the video data as if it were a stream.

I have a QTCaptureMovieFileOutput and I am passing nil as the file URL so that it doesn't actually record the data to the file (I'm only interested in the data contained in the QTSampleBuffer that is available via the delegate callback).

I have set a QTCompressionOptions object on the output specifying H264 Video and High Quality AAC Audio compression.

Each time I receive a call back, I append the data from the sample buffer into an NSMutableData object I have as an instance variable.

The problem I have is that no 'player' object in the QTKit framework seems capable of playing a 'stream' of video data. Am I correct in this assumption?

I tried creating a QTMovie object (to play in a QTMovieView) using my data instance variable but I get the er开发者_如何学Cror that the data is not a movie.

Am I approaching this issue from the wrong angle?

Previously I was using a QTCapturePreviewOutput which passes CVImageBufferRefs for each video frame. I was converting these frames into NSImages to display on a view.

While this gave the impression of streaming, it was slow and processor hungry.

How have other people conquered the streaming video problem?


Seems to me like you'd need to make a GL texture and then load the data into it on a per-frame basis. Everything about QTMovie seems to be based on pre-existing files, as far as my little mind can tell.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜