菜鸟教程小白 发表于 2022-12-13 06:37:39

ios - 使用 AVAsset 的多个图像到视频需要高内存


                                            <p><p>当输入图像超过 500 个时,我已经看到了关于如何创建视频的大多数问题(在 stackoverflow 上提出)。我尝试使用提供的所有答案从图像(超过 500 个图像)创建视频,但是它们会导致高内存使用,因此我的应用程序由于高内存使用而崩溃。</p>

<p>我试过这个链接,但没有得到满意的结果。
<a href="https://stackoverflow.com/questions/7371428/ios5-avfoundation-image-to-video" rel="noreferrer noopener nofollow">iOS5 AVFoundation image to video</a> </p>

<p> <a href="https://stackoverflow.com/questions/28409041/ios-cvpixelbuffercreate-memory-cannot-release-correctly-when-making-image-to-vi" rel="noreferrer noopener nofollow">iOS- CVPixelBufferCreate memory cannot release correctly when making image to video</a> </p>

<p> <a href="https://stackoverflow.com/questions/4732302/create-video-from-array-of-uiimages-and-save-the-video-to-iphone-library-avasse?rq=1" rel="noreferrer noopener nofollow">create video from array of UIImages and save the video to iPhone library. AVAssetLibrary +AVFoundation</a> </p>

<p>除此之外,我还尝试了另一个链接。当有超过 500 张图像时,请帮助我创建视频。
谢谢。</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>不要像 <a href="https://stackoverflow.com/questions/28409041/ios-cvpixelbuffercreate-memory-cannot-release-correctly-when-making-image-to-vi" rel="noreferrer noopener nofollow">iOS- CVPixelBufferCreate memory cannot release correctly</a> 那样在主线程上生成电影。 ... 例子。 </p>

<p>其次,在处理单个电影帧的循环中添加一个 @autoreleasepool。</p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 使用 AVAsset 的多个图像到视频需要高内存,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/29821510/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/29821510/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 使用 AVAsset 的多个图像到视频需要高内存