Questions tagged [avassetwriter]

on OS X API, you use an AVAssetWriter object to write media data to a new file of a specified audiovisual container type, such as a QuickTime movie file or an MPEG-4 file, with support for automatic interleaving of media data for multiple concurrent tracks

529 questions
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
8
votes
2 answers

How to trim the video file and convert to 15 seconds video with iOS SDK?

I want to trim a video file. I want to just pick the video from a gallery and convert it to a 15-second video. If I use normal trimming with picker view controller, it does not specify a time and just shows the frames, but I need to be fixed for 15…
Ramkumar Paulraj
  • 1,841
  • 2
  • 20
  • 40
8
votes
1 answer

How to choose the a pixel format type (kCVPixelBufferPixelFormatTypeKey) for use with AVAssetReader?

We are using AVAssetReader and AVAssetWriter somewhat in the style as noted in Video Encoding using AVAssetWriter - CRASHES basically to read a video what we got from the photo gallery / asset library then writing it at a different bit rate to…
Chris Markle
  • 2,076
  • 4
  • 25
  • 46
8
votes
1 answer

is it possible for avassetwriter to output to memory

I would like to write an iphone app that continuously capture video, h.264 encode them in 10 seconds interval and upload to a storage server. This can be done with avassetwriter, and I can keep on deleting the old files as I create new ones. …
J.C. Li
  • 141
  • 2
  • 4
8
votes
3 answers

Screen capture video in iOS programmatically

I'm trying to create a UIView that allows a user to tap a button in i and record the screen (not make a video from the camera), then save it to the document folder. I've seen a couple of SO articles here that talk about AVAssetWriter and make…
Doug
  • 169
  • 1
  • 2
  • 12
7
votes
5 answers

Pixel formats, CVPixelBufferRefs and glReadPixels

I'm using glReadPixels to read data into a CVPixelBufferRef. I use the CVPixelBufferRef as the input into an AVAssetWriter. Unfortunately the pixel formats seem to be mismatched. I think glReadPixels is returning pixel data in RGBA format while…
MrDatabase
  • 43,245
  • 41
  • 111
  • 153
7
votes
5 answers

AVFoundation record 10 bit HDR video on iPhone 12

iPhone 12/12 pro supports recording Dolby vision HDR video in 10 bit format instead of 8 bits but it is not clear from iOS 14.1 SDK if AVCaptureVideoDataOutput supports delivery of 10 bit sample buffers that can be appended to video file using…
7
votes
0 answers

How to record audio from the mic while appending a modified sampleBuffer image to the AVAssetWriter

This is an extension to an unanswered question I had before: AVCaptureSession is not recording audio from the mic in Swift I'm very unclear how I can write both video that is being modified in real time and audio that is being recorded from the…
Chewie The Chorkie
  • 4,896
  • 9
  • 46
  • 90
7
votes
1 answer

AVAssetWriter multiple sessions and the status property

I am attempting to create multiple, serial writing sessions with AVAssetWriter. Once I've completed one successfully (after calling finishWriting) the status is set to 2 (AVAssetWriterStatusCompleted). Trying to create another session, I call…
akaru
  • 6,299
  • 9
  • 63
  • 102
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,…
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
7
votes
1 answer

How to add static and dynamic overlays to video with AVAssetWriter?

What's the right way to add an image overlay to a video created with AVAssetWriter? It's possible to do so with AVAssetExportSession, but this question is about how to do so with AVAssetWriter so there is more control over the quality and…
Crashalot
  • 33,605
  • 61
  • 269
  • 439
7
votes
1 answer

AVfoundation Reverse Video

I tried to make video in reverse. While playing asset in AVPlayer i set the rate = -1 to make it work in reverse format. But how to export that video? I looked into docs. read about avassetwrite, sambuffers , compositions but didn't find any way to…
7
votes
1 answer

Changing AVCaptureDeviceInput leads to AVAssetWriterStatusFailed

I am trying to change the Camera View Front and Back.it is working well.if video is recorded without flipping with Pause/Record Option it is working fine.But if we Flip Camera View once then, further recording video is not saving which leads to…
7
votes
1 answer

AVAssetWriterInput H.264 Passthrough to QuickTime (.mov) - Passing in SPS/PPS to create avcC atom?

I have a stream of H.264/AVC NALs consisting of types 1 (P frame), 5 (I frame), 7 (SPS), and 8 (PPS). I want to write them into an .mov file without re-encoding. I'm attempting to use AVAssetWriter to do this. The documentation for…
bsirang
  • 473
  • 4
  • 14