QTKit 无法正确混合音轨
我试图导入一个电影文件两次(2 个单独的 QTMovie 实例),将第二个实例的音轨偏移一秒,然后将其与第一个实例的音轨混合。它不混合。第一首曲目开始播放,然后停止,第二首曲目开始播放。当我使用两个内容不同的电影文件时,这种情况不会发生,但当我将文件复制到不同的名称时,这种情况仍然会发生!我创建了一个简单的示例项目来说明问题: http://cl.ly/0s2U2s3S2F0Y052D2v0O/InsertTrack.zip< /a>
我也很乐意付费解决这个问题!
I'm trying to import a single movie file twice (2 separate QTMovie instances) offset the audio track of the second instance by a second and then mix it with the audio track of the first instance. It doesn't mix. The first track starts to play and then it stops and the second track starts to play. This doesn't happen when I use 2 movie files with different content but it still happens when I copy the file to a different name! I created a simple example project that illustrates the problem: http://cl.ly/0s2U2s3S2F0Y052D2v0O/InsertTrack.zip
I'm also happy to pay for the solution to this problem!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决方案并不是很直接,因为这里发生了一些事情:
-[QTMovie insertSegmentOf(Movie|Track):timeRange:atTime:]
不如果轨道的编码与已存在的轨道的编码匹配,则将轨道添加到电影中。相反,它会将片段插入到现有电影中,就像 QuickTime Player Pro 的“添加选择”所做的那样(即,如果您的电影是 AAAAA 并且您插入 bbb,那么您将获得 AAbbbAAA)。 (诚然,这里的类引用不是很简洁......)-[QTMovie insertSegmentOfTrack:fromRange:scaledToRange:]
也不添加轨道。相反,它的行为类似于insertSegmentOfTrack:timeRange:atTime:
,并具有更改插入片段的持续时间的附加功能。解决方案是使用
-[QTMovie insertSegmentOfMovie:fromRange:scaledToRange:]
。对于你的例子,这将成为
我知道的,这实际上是相当直接的代码的引导加载......但这就是它的工作方式:-(
The solution isn't quite straight forward, as there are a few things going on here:
-[QTMovie insertSegmentOf(Movie|Track):timeRange:atTime:]
does not add tracks to a movie, if the encoding of the track(s) match that of the track(s) that are already present. Instead, it inserts the segment into the existing movie, as QuickTime Player Pro's "Add Selection" does (i.e. if your movie was AAAAA and you insert bbb then you get AAbbbAAA). (Admittedly, the class-reference isn't very concise here…)-[QTMovie insertSegmentOfTrack:fromRange:scaledToRange:]
does not add tracks either. Instead, it behaves likeinsertSegmentOfTrack:timeRange:atTime:
with the added ability to change the duration of the inserted segment.The solution is to use
-[QTMovie insertSegmentOfMovie:fromRange:scaledToRange:]
.For your example this would become
I know, it's quite a bootload of code for something that's actually pretty straight-forward…but that's the way it works :-(