Comments (8)
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.
No problem. Being able to pause and resume recording would be great feature. Great work by the way.
from cameraengine.
@MFaarkrog I did, it already implemented. Please update your pod.
Do you still have the issue ?
from cameraengine.
I will check that. Thank you so much for your return ! It really helps.
from cameraengine.
@remirobert Great work on this library 👍 Any chance you know when you'll update the above?
from cameraengine.
@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.
@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.
It's fixed, check the next commit with swift 3 update
from cameraengine.
Related Issues (20)
- crash on second takePhoto HOT 2
- Photo capture with presser .photo So slow.
- Flipping the camera, not saving video
- Never called deinit method in CameraEngine HOT 1
- Just iOS 10 support?
- README typo
- How to start with front camera, also I cant get face detection to work.
- Randomly crashes at the start.
- configureOutputDevice() crash in CameraEngine! HOT 1
- NSArrayM was mutated while being enumerated. HOT 2
- Crash
- Carthage: Dependency "CameraEngine" has no shared framework schemes HOT 3
- Crash: Thread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0) HOT 4
- Cant get barcode detection to wok HOT 1
- Randomly getting white screen on start, but records in background HOT 1
- is it possible to store video buffer for 5 seconds and after tap of button, it save the last 5 seconds?
- Some updates in order to compile after pod install HOT 2
- How to crop Photo
- [WIP] Swift 4 and some new api is available here HOT 6
- Any development plan for 4k 60fps?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cameraengine.