Vodolazkyi / VAVideoCompressor

Video compressor written in swift
MIT License
18 stars 2 forks source link

readyForMoreMediaData crash #1

Open UtkuDalmaz opened 4 years ago

UtkuDalmaz commented 4 years ago

Cannot append sample buffer: readyForMoreMediaData is NO

manucodin commented 4 years ago
  private static func encodeReadySamplesFromOutput(
        _ output: AVAssetReaderOutput,
        input: AVAssetWriterInput,
        reader: AVAssetReader,
        writer: AVAssetWriter
        ) -> Bool {

        let readyForMediaCondition = NSCondition()
        while input.isReadyForMoreMediaData {
            readyForMediaCondition.wait()
            if let sampleBuffer = output.copyNextSampleBuffer() {
                if reader.status != .reading || writer.status != .writing {
                    return false
                }

                if !input.append(sampleBuffer) {
                    return false
                }

            } else {
                input.markAsFinished()
                return false
            }
        }
        return true
    }

Same error, some possible solution.

malonehedges commented 4 years ago

@MRodSebastian the snippet you posted doesn't let the compression finish in my project. did you ever get a fix working on your end?

manucodin commented 4 years ago

@MRodSebastian the snippet you posted doesn't let the compression finish in my project. did you ever get a fix working on your end?

Sorry but this snippet worked for me and i dont know you environment (if you save video in local or temp, url format...). But still this compressor kept giving me problems in the compression process and I had to change it and use another compressor and still modify the compressor.

malonehedges commented 4 years ago

@MRodSebastian ah gotcha. Checking out some other compressor options. Thanks for replying! :)

Razanajam commented 4 years ago

Exactly the issue is still there, and the new snippet is never-ending compression, It's a failed code.