Giter Club home page Giter Club logo

Comments (8)

roceller avatar roceller commented on July 28, 2024 3

I figured out the issue. The appendBuffer is writing audio ahead of the video. As a workaround, I don't do startWriting until video is given....

func appendBuffer(sampleBuffer: CMSampleBuffer!, isVideo: Bool) {
    if CMSampleBufferDataIsReady(sampleBuffer) {
        //MARK:ROSS - start writing only when video is ready...
        if self.assetWriter.status == AVAssetWriterStatus.Unknown && isVideo {
            print("Writer: startWriting")
            let startTime = CMSampleBufferGetPresentationTimeStamp(sampleBuffer)
            self.assetWriter.startWriting()
            self.assetWriter.startSessionAtSourceTime(startTime)
        }
        if isVideo {
            if self.videoInputWriter.readyForMoreMediaData {
                print("Writing video...")
                self.videoInputWriter.appendSampleBuffer(sampleBuffer)
            }
        }
        else {
            if self.audioInputWriter.readyForMoreMediaData {
                print("Writing audio...")
                self.audioInputWriter.appendSampleBuffer(sampleBuffer)
            }
        }
    }
}

from cameraengine.

roceller avatar roceller commented on July 28, 2024 2

No problem. Being able to pause and resume recording would be great feature. Great work by the way.

from cameraengine.

remirobert avatar remirobert commented on July 28, 2024 1

@MFaarkrog I did, it already implemented. Please update your pod.
Do you still have the issue ?

from cameraengine.

remirobert avatar remirobert commented on July 28, 2024

I will check that. Thank you so much for your return ! It really helps.

from cameraengine.

MFaarkrog avatar MFaarkrog commented on July 28, 2024

@remirobert Great work on this library 👍 Any chance you know when you'll update the above?

from cameraengine.

otymartin avatar otymartin commented on July 28, 2024

@remirobert
Hey this issue still persists. I checked your code and missing was && isVideo in this line by @roceller

 if self.assetWriter.status == AVAssetWriterStatus.Unknown && isVideo

which fixes the problem for me atleast. Whereas before, each video I took had a black or white frame at the start.

from cameraengine.

MFaarkrog avatar MFaarkrog commented on July 28, 2024

@remirobert Sorry for the delayed response. Yeah, I still have the issue in the project I'm working on.
I haven't tried otymartin's fix yet, though.

from cameraengine.

remirobert avatar remirobert commented on July 28, 2024

It's fixed, check the next commit with swift 3 update

from cameraengine.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.