Skip to content

Crash on generating video from photos & audio. #80

@naresh-kumar-ios

Description

@naresh-kumar-ios

I am facing one crash of array index out of range while creating the video from one audio & multiple images.

@IBAction func proccedButtonHandler(sender: UIButton) {
if let audioURL4 = Bundle.main.url(forResource: "Barish2" , withExtension: "mp3") {
VideoGenerator.current.generate(withImages: self.images ?? [], andAudios: [audioURL4], andType: .singleAudioMultipleImage) { (progress) in
print(progress)
} outcome: { (result) in
switch (result) {
case .success(let url):
print("URL: ", url)

            case .failure(let error):
                print(error)
            }
        }

    } else {
        print("Mising audio file")
    }
}

Crash line is:
Line: 178: imageForVideo = VideoGenerator.current.images[frameCount]
File: VideoGenerator.swift

Screen Shot:
Screenshot 2021-05-06 at 3 27 23 PM

And the Crash Logs are:

<NSProgress: 0x280a881e0> : Parent: 0x0 (portion: 0) / Fraction completed: 0.0833 / Completed: 1 of 12
<NSProgress: 0x280a881e0> : Parent: 0x0 (portion: 0) / Fraction completed: 0.1667 / Completed: 2 of 12
<NSProgress: 0x280a881e0> : Parent: 0x0 (portion: 0) / Fraction completed: 0.2500 / Completed: 3 of 12
<NSProgress: 0x280a881e0> : Parent: 0x0 (portion: 0) / Fraction completed: 0.3333 / Completed: 4 of 12
Images set 0
<NSProgress: 0x280a881e0> : Parent: 0x0 (portion: 0) / Fraction completed: 0.4167 / Completed: 5 of 12
Fatal error: Index out of range: file Swift/ContiguousArrayBuffer.swift, line 444
VideoGenerator: AVAssetWriterInputPixelBufferAdapter failed to append pixel buffer
Images set 0
VideoGenerator: AVAssetWriterInputPixelBufferAdapter failed to append pixel buffer
2021-05-06 15:27:12.239465+0530 VideoMaker[1852:157203] Fatal error: Index out of range: file Swift/ContiguousArrayBuffer.swift, line 444

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions