• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

AVMutableComposition - 视频资产:间的空白/黑框

用户头像
it1352
帮助1

问题说明

我目前正在尝试使用AVMutableComposition背靠背放置5个视频,如下所示:

I'm currently trying to put 5 videos back to back using AVMutableComposition like so:

[mixComposition insertTimeRange:CMTimeRangeMake(kCMTimeZero, asset1.duration) ofAsset:asset1 atTime:[mixComposition duration] error:nil];
[mixComposition insertTimeRange:CMTimeRangeMake(kCMTimeZero, asset2.duration) ofAsset:asset2 atTime:[mixComposition duration] error:nil];
[mixComposition insertTimeRange:CMTimeRangeMake(kCMTimeZero, asset3.duration) ofAsset:asset3 atTime:[mixComposition duration] error:nil];
[mixComposition insertTimeRange:CMTimeRangeMake(kCMTimeZero, asset4.duration) ofAsset:asset4 atTime:[mixComposition duration] error:nil];
[mixComposition insertTimeRange:CMTimeRangeMake(kCMTimeZero, asset5.duration) ofAsset:asset5 atTime:[mixComposition duration] error:nil];

然后我使用AVAssetExportSession导出视频,但是在我获得的视频之间有效我需要删除的空白/黑框。有没有人之前有这个问题,如果是这样你设法解决它?

I then use an AVAssetExportSession to export the video, which works however between each video I'm getting a blank/black frame which I need to remove. Has anyone had this problem before and if so did you manage to fix it?

此外,空白帧不在源视频文件中。

Also, the blank frames aren't in the source video files.

提前致谢。

正确答案

#1

前几天我遇到了同样的问题。

I had the same problem the other day.

如果您通过从再次使用insertTimeRange创建的其他资产中导出资产(asset1,asset2等),则情况相同。

If you got your assets(asset1, asset2, etc.) by exporting them from other asset which was created using again insertTimeRange, then it's the same case.

问题在于,当您导出使用insertTimeRange创建的资源时,导出不正确,当您附加此类视频时,它们之间会出现黑框。

The problem is that when you export assets created using insertTimeRange, the export doesn't go correct, when you attach such videos black frames appear between them.

尝试使用AVAssetExportSession的timeRange选项,并从主资源中删除所需的范围。那么您的资产将附加正确。

Try using "timeRange" option of the AVAssetExportSession, and cut the range you need from the main asset. Then your assets will attach correct.

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /reply/detail/tanhcfijeh
系列文章
更多 icon
同类精品
更多 icon
继续加载