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
68
votes
2 answers

This code to write video+audio through AVAssetWriter and AVAssetWriterInputs is not working. Why?

I've been trying to write a video+audio using AVAssetWriter and AVAssetWriterInputs. I read multiple posts in this forum of people saying they were able to accomplish that, but it is not working for me. If I just write video then the code is doing…
kalos
  • 793
  • 1
  • 6
  • 6
47
votes
2 answers

Make movie file with picture Array and song file, using AVAsset

I'm trying to make movie file using a picture array and an audio file. To make movie with a picture array i used the big post by zoul here. All is perfect, I have my movie with my picture. However when I try to add some audio tracks I have lot of…
TheRonin
  • 1,305
  • 1
  • 12
  • 18
39
votes
2 answers

AVFoundation + AssetWriter: Generate Movie With Images and Audio

I have to export a movie from my iPhone application which contains UIImage from an NSArray and add some audio files in .caf format that have to start at pre-specified times. Now I have been able to use the AVAssetWriter (after going through many…
MuTaTeD
  • 861
  • 2
  • 8
  • 13
28
votes
1 answer

What does shouldOptimizeForNetworkUse actually do?

From the Apple documentation it just says: When the value of this property is YES, the output file will be written in such a way that playback can start after only a small amount of the file is downloaded. But what is actually happening?
22
votes
1 answer

How do I use AVAssetWriter?

I’d like to take some video frames and encode them into a video. It looks like that’s exactly what AVAssetWriter was meant for, but no matter how I eyeball the docs and Google I can’t find any way to actually use it. From the docs it looks like I…
zoul
  • 102,279
  • 44
  • 260
  • 354
21
votes
2 answers

How to write a movie with video AND audio using AVAssetWriter?

I want to export a movie with AVAssetWriter and can't figure out how to include video and audio tracks in sync. Exporting only video works fine, but when I add audio the resulting movie looks like this: First I see the video (without audio), then…
Walchy
  • 1,150
  • 3
  • 11
  • 18
20
votes
1 answer

Video Encoding using AVAssetWriter - CRASHES

I have a function that is supposed to re-encode a video to a manageable bitrate on iphone/ipad. Here it is: *UPDATED WORKING CODE, NOW WITH AUDIO! :) * -(void)resizeVideo:(NSString*)pathy{ NSString *newName = [pathy…
box86rowh
  • 3,415
  • 2
  • 26
  • 37
18
votes
5 answers

Completion handler is not called on iOS7 GM

I'm using AVAssetWriter, and it is perfectly working on iOS6. The problem is, when I called finishWritingWithCompletionHandler, the completion handler is not called on iOS7 GM. I called markAsFinished, and even endSessionAtSourceTime before I call…
Seho Kim
  • 185
  • 1
  • 6
18
votes
1 answer

appendSampleBuffer with an audio AVAssetWriterInput "leaks" memory until endSessionAtSourceTime

I have a strange memory "leak" with AVAssetWriterInput appendSampleBuffer. I'm writing video and audio at the same time, so I have one AVAssetWriter with two inputs, one for video and one for audio: self.videoWriter = [[[AVAssetWriter alloc]…
kevlar
  • 1,110
  • 3
  • 17
  • 30
17
votes
4 answers

How to use CVPixelBufferPool in conjunction with AVAssetWriterInputPixelBufferAdaptor in iPhone?

I have successfully created video from images using the following code -(void)writeImageAsMovie:(NSArray *)array toPath:(NSString*)path size:(CGSize)size duration:(int)duration { NSError *error = nil; AVAssetWriter *videoWriter =…
Atulkumar V. Jain
  • 5,102
  • 9
  • 44
  • 61
17
votes
4 answers

How to merge a *Single Image* with a video

I am trying to combine a single video with a single image. This is not trying to combine many images into a single video such as create movie from [UIImage], Swift How do I export UIImage array as a movie? Make movie file with picture Array and…
impression7vx
  • 1,728
  • 1
  • 20
  • 50
16
votes
1 answer

Save AVCaptureVideoDataOutput to movie file using AVAssetWriter in Swift

I've been looking all over the web and can't seem to find a tutorial or help in what I need. Using AVFoundation and the Dlib library I've created an app that can detect a face from real time video using the front camera on the phone. I'm doing this…
Hardy143
  • 577
  • 4
  • 13
16
votes
4 answers

Anyone have an example of how to write audio and video simultaneously using AVAssetWriter?

Been trying to figure this out with zero success. I can write video output no problem ... but once I try to introduce a second AVAssetWriterInput to include audio the final quicktime movie is jumpy with frames being loss left and right and audio…
wgpubs
  • 8,131
  • 15
  • 62
  • 109
15
votes
2 answers

AVAssetWriter finishWriting fails on iOS 6 Simulator

It seems that finishWriting is broken on iOS 6 simulator - it hangs forever. It's now deprecated and replaced by the new finishWritingWithCompletionHandler: - which also never calls the handler. On real devices running iOS 6, this works just fine as…
user1574100
  • 171
  • 1
  • 5
14
votes
3 answers

AVAssetWriterInputPixelBufferAdaptor and CMTime

I'm writing some frames to video with AVAssetWriterInputPixelBufferAdaptor, and the behavior w.r.t. time isn't what I'd expect. If I write just one frame: [videoWriter startSessionAtSourceTime:kCMTimeZero]; [adaptor appendPixelBuffer:pxBuffer…
David Moles
  • 48,006
  • 27
  • 136
  • 235
1
2 3
35 36