如何更改 QTTrack 的不透明度
我正在尝试制作带有画中画的 QTMovie。我有两部电影,一部是文件中的视频,一部是用相机录制的。
我希望相机影片显示在其他视频之上并且稍微透明。我可以使用 qttrack 将相机影片定位在其他视频上,但我不知道如何更改视频上 qttrack 的透明度。
使用 QTKit 可以吗?
这是我现在的代码示例
QTTimeRange fullMovieDuration = QTMakeTimeRange(QTZeroTime, [mCameraMovie duration]);
QTTime startTime = QTMakeTime(0, [mCameraMovie currentTime].timeScale);
QTTrack *cameraTrack = [[mCameraMovie tracks] objectAtIndex:0];
NSRect newCameraRect = NSMakeRect(100, 100, 320, 240);
[cameraTrack setAttribute:[NSValue valueWithRect:newCameraRect] forKey:QTTrackBoundsAttribute];
[mMovie setAttribute:[NSNumber numberWithBool:YES] forKey:QTMovieEditableAttribute];
[mMovie insertSegmentOfTrack:cameraTrack timeRange:fullMovieDuration atTime:startTime];
[ibMovieView setMovie:mMovie];
I'm trying to make a QTMovie with picture in picture. I have two movies, one that is a video from a file, and one recorded with a camera.
I want the camera movie to show up above the other video and be slightly transparent. I can position the camera movie over the other video fine using a qttrack, but I don't know how to change the transparency of the qttrack on the video.
Is this possible using QTKit?
Here is an example of my code right now
QTTimeRange fullMovieDuration = QTMakeTimeRange(QTZeroTime, [mCameraMovie duration]);
QTTime startTime = QTMakeTime(0, [mCameraMovie currentTime].timeScale);
QTTrack *cameraTrack = [[mCameraMovie tracks] objectAtIndex:0];
NSRect newCameraRect = NSMakeRect(100, 100, 320, 240);
[cameraTrack setAttribute:[NSValue valueWithRect:newCameraRect] forKey:QTTrackBoundsAttribute];
[mMovie setAttribute:[NSNumber numberWithBool:YES] forKey:QTMovieEditableAttribute];
[mMovie insertSegmentOfTrack:cameraTrack timeRange:fullMovieDuration atTime:startTime];
[ibMovieView setMovie:mMovie];
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我可以使用 Quicktime 来做到这一点。
这是一个完成它的类别。
头
文件
I was able to do it using Quicktime.
Here's a category that got it done.
Header
Source File