Giter VIP home page Giter VIP logo

Comments (7)

YuAo avatar YuAo commented on May 26, 2024 1

Because the actual encoding is an async operation, we cannot throw the error here to the caller.

If we want to report this error "immediately" after it occurs we need an async signal, for example, a "recordingFailedHandler".

from videoio.

YuAo avatar YuAo commented on May 26, 2024

I think the current implementation is perfectly fine according to the documentation you referred.

There are two kinds of time movie time and sample time (source time).

a sample you append with timestamp T plays at movie time (T-startTime)

If the session begins at sample time T, then simple with time T begins at "movie time" (T - startTime) => (T - T) => 0


Anyway, can you provide more detail about the issue you encountered?

Is there an error reported when you call stopRecording(completion:)?
Is there something like "Video inputs: not ready for media data" in the console?
What about the recording duration reported in the durationChangedHandler?

from videoio.

dsmurfin avatar dsmurfin commented on May 26, 2024

If the session begins at sample time T, then simple with time T begins at "movie time"

Thanks. That makes sense. I had almost come to this conclusion after some more digging last night.

This was a failure in the field, so I have no console data to hand unfortunately. I logged a failure to stop recording 2022-02-02 20:45:24.842 [Error] [main] [704] > [Recording] Failed to stop recording, but unfortunately at this point I was not including the error from stopRecording(completion:) (I am now).

The resulting track when run through moov validation reports an error in the duration. The Edits duration was the time actually before the stop, and the difference matches exactly with the missing frames (about 25 mins).

MP4/QuickTime Validator |   | Warning | [897] tkhd incorrect duration. TrackID = 2. Edits duration = 183471994, TrackHeader duration = 183473548. Atom/Box path:moov-trak[2]-tkhd (Offset: 0x000000000019C11C)

from videoio.

YuAo avatar YuAo commented on May 26, 2024

It seems to be the case that the writer failed to append more frames duration recording:

if self.videoInputs[index].append(sampleBuffer) {
self.lastVideoSampleTime = presentationTime
let startTime = self.recordingStartSampleTime
let duration = presentationTime - startTime
self._duration = duration
DispatchQueue.main.async {
self.durationChangedHandler?(duration)
}
} else {
if let error = self.assetWriter.error {
self.transitionToFailedStatus(error: error)
return
}
}

This could be caused by:

  • Appending a frame that has earlier/equal timestamp than a previously appended frame.
  • There's no enough disk space.
  • ...

from videoio.

dsmurfin avatar dsmurfin commented on May 26, 2024

There's no enough disk space.

I think we may be running into this. Of course this just returns here rather than throwing, so unless we check the error state we don't know what has happened until we attempt to finalize the recording.

from videoio.

YuAo avatar YuAo commented on May 26, 2024

I'll take a closer look at this later this weekend.

from videoio.

dsmurfin avatar dsmurfin commented on May 26, 2024

Amazing. Thank you.

from videoio.

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.