Questions tagged [avassetwriterinput]
37 questions
9
votes
2 answers
LLSimpleCamera : AVAssetWriterInput appendSampleBuffer crashing
I am using LLSimpleCamera for recording a video. It's recording fine when I use rear camera but when I switch to front camera, app crashes and the error reported is
* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason:…

Preetika
- 702
- 8
- 21
9
votes
2 answers
Making a real slow motion video that are all slow motion
I am creating this app of mine and shooting videos at 120 and 240 fps.
When I watch these videos on my mac I see these markers below the timeline.
These markers are editable and represent the area that is in slow motion. So, the video starts at…

Duck
- 34,902
- 47
- 248
- 470
8
votes
3 answers
Record video with AVAssetWriter: first frames are black
I am recording video (the user also can switch to audio only) with AVAssetWriter. I start the recording when the app is launched.
But the first frames are black (or very dark). This also happens when I switch from audio to video.
It feels like the…

Marie Dm
- 2,637
- 3
- 24
- 43
7
votes
1 answer
AVAssetWriter convert aac 5.1 audio track from AVAsset fail on appendSampleBuffer
I am trying to extract audio track from .mp4 video file and convert to .m4a audio file with this outputSettings using AVAssetWriter class
AudioChannelLayout channelLayout;
memset(&channelLayout, 0,…

Gennadiy Mishin
- 121
- 4
7
votes
0 answers
Proper way to stop a video recording (finishWriting) with AVAssetWriter and without crashing
I record videos with AVAssetWriter. The user can send the video, then I call finishWriting, or cancel the recording, then I call cancelWriting.
How I record:
func captureOutput(_ captureOutput: AVCaptureOutput!, didOutputSampleBuffer sampleBuffer:…

Marie Dm
- 2,637
- 3
- 24
- 43
6
votes
4 answers
iOS how to correctly handle orientation when capturing video using AVAssetWriter
I am making a sample application that utilizes AVFoundation to record video. The whole point is so I can have more control over how the video is recorded. In my sample project I have the video capturing but am struggling with handling orientation…

miken.mkndev
- 1,821
- 3
- 25
- 39
5
votes
1 answer
How to set expected framerate to AVAssetWriterInput
I have an app which encodes videos in different ways and saves it to Photos library - it can cut specific time range, add pictures, text, etc. Everything is working perfectly till I try to encode video 120+ fps. The problem is that video appears to…

Eugene Alexeev
- 1,152
- 12
- 32
4
votes
2 answers
AVAssetWriter codec type hevc
I a trying to transcode an H264 video to HEVC using AVAssetWriter and it fails on iPhone 6s. Supposedly, the iPhone 6s supports HEVC for transcoding, not real-time video encoding. The same code works on iPhone 7 and above. If the iPhone 6s doesn't…

Deepak Sharma
- 5,577
- 7
- 55
- 131
3
votes
3 answers
AVAssetWriterInput append fails with error code -11800 AVErrorUnknown -12780
I am trying to capture camera video in memory using AVCaptureSession so that I can later write the video data to a movie file. While I have been able to successfully start a capture session, I am not able to successful write the CMSampleBuffers I've…

mmontalbo
- 405
- 2
- 6
- 12
3
votes
0 answers
How to create several mp4 files with AVAssetWriter at the same time
I try to save four video streams with AVAssetWriter on the iPhone as .mp4. With three streams everything works fine, but the 4th mp4 file is always empty.
Here is a piece of my code:
-(void)writeImagesToMovie:(CVPixelBufferRef) buffer :(int)…

AxelHerbert
- 31
- 3
2
votes
1 answer
How do you sync video and audio using AVAssetWriter?
Background
I use AVAssetWriterInput.append to append sample buffers to the writer. Sometimes, I switch off the audio input (if the user wants to temporarily disable audio input), so the append method will not be executed while the append method in…

LiYanan2004
- 41
- 5
2
votes
0 answers
isReadyForMoreMediaData and AVAssetWriterInput
I created a screen recording app.
Before appending the buffer to the writer, I check if the isReadyForMoreMediaData is true.
But sometimes it will constantly return false and won’t become true until I call markAsFinished
I have no idea how to fix…

LiYanan2004
- 41
- 5
2
votes
2 answers
AVAssetWriterInput - Insufficient video frames for Captured Audio
I've got a moderately complicated AVAssetWriterInput setup that I'm using to be able to flip the camera while I'm recording. Basically run two sessions, when the user taps to flip the camera I disconnect session 1 from the output and attach session…

nickneedsaname
- 731
- 1
- 5
- 22
2
votes
1 answer
AVAssetWriter - Set Custom frame rate
I am using AVAssetWriter to write video frames from ARSession using delegate.
func session(_ session: ARSession, didUpdate frame: ARFrame)
See below the code used to write images.
How can I set custom frame rate like 24, 30 or 60 etc as per our…

jpulikkottil
- 666
- 9
- 24
2
votes
1 answer
AVAssetWriter NSOSStatusErrorDomain Code=-16155
I'm having an error when I'm recording a long video. The weird thing is this happens always when I have been recording for 1 hour and 30 min aprox.
I'm recording a video and two audio tracks using AVAssetWriter.
Error Domain=AVFoundationErrorDomain…

Pablo Martinez
- 1,573
- 12
- 31