Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash on generating video from photos & audio. #80

Open
naresh-kumar-ios opened this issue May 6, 2021 · 2 comments
Open

Crash on generating video from photos & audio. #80

naresh-kumar-ios opened this issue May 6, 2021 · 2 comments

Comments

@naresh-kumar-ios
Copy link

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

@naresh-kumar-ios naresh-kumar-ios changed the title Crash on selecting generating video from photos & song. Crash on generating video from photos & audio. May 6, 2021
@naresh-kumar-ios
Copy link
Author

What I observed is, the VideoGenerator.current.images are setting to 0. I am not able to find why the sent images are relinquished.

@Shahrukhpatel007
Copy link

Hi @Naresh6885
Please check your audio file is proper or not in my case audio file was not proper so that's why I was getting this crash

Please check the size of audio file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants