如何以编程方式将 QuickTime 影片传输到 Quartz Composer 输入中?
我正在开发一个将 Quartz Composer 效果应用于 QuickTime 电影的应用程序。想想 Photo Booth,除了使用 QuickTime 影片作为输入,而不是相机。目前,我正在将 QuickTime 影片作为 QTMovie
对象加载,然后让 NSTimer
每秒触发 30 次。在某些时候,我会切换到 CVDisplayLink ,但目前 NSTimer 还可以。每次 NSTimer
触发时,应用程序都会抓取 QuickTime 影片的一帧作为 NSImage
并将其传递给 QCRenderer
的图像之一输入。这可行,但是非常慢。我尝试以 [QTMovie frameImageAtTime:withAttributes:error:]
支持的所有格式从电影中提取帧。它们要么非常慢,要么根本不起作用。
我假设速度缓慢是由于将图像数据移至主内存,然后将其移回以供 QC 处理而引起的。
不幸的是,对于这个项目来说,使用 QC 的 QuickTime 电影补丁是不可能的,因为我需要对电影播放进行更多的控制。所以问题是,如何在不离开 VRAM 的情况下将 QuickTime 电影图像移至 QCRenderer 中?
I'm working on an app that applies Quartz Composer effects to QuickTime movies. Think Photo Booth, except with a QuickTime movie for the input, not a camera. Currently, I am loading a quicktime movie as a QTMovie
object, then have an NSTimer
firing 30 times a second. At some point I'll switch to a CVDisplayLink
, but NSTimer
is okay for now. Every time the NSTimer
fires, the app grabs one frame of the quicktime movie as an NSImage
and passes it to one of the QCRenderer
's image inputs. This works, but is extremely slow. I've tried pulling frames from the movie in all of the formats that [QTMovie frameImageAtTime:withAttributes:error:]
supports. They are all either really slow, or don't work at all.
I'm assuming that the slowness is caused by moving the image data to main memory, then moving it back for QC to work on it.
Unfortunately, using QC's QuickTime movie patch is out of the question for this project, as I need more control of movie playback than that provides. So the question is, how can I move QuickTime movie images into my QCRenderer without leaving VRAM?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看开源的 v002 电影播放器 QCPlugin。不管怎样,你到底还有什么控制权?
Check out the v002 Movie Player QCPlugin which is open source. Anyway, what more controls do you have exactly?