Questions tagged [avassetreader]

You use an AVAssetReader object to obtain media data of an asset, whether the asset is file-based or represents an assemblage of media data from multiple sources (as with an AVComposition object).

AVAssetReader lets you:

Read raw un-decoded media samples directly from storage, obtain samples decoded into renderable forms. Mix multiple audio tracks of the asset and compose multiple video tracks (by using AVAssetReaderAudioMixOutput and AVAssetReaderVideoCompositionOutput). AVAssetReader’s pipelines are multithreaded internally. After you initiate reading with initWithAsset:error:, a reader loads and processes a reasonable amount of sample data ahead of use so that retrieval operations such as copyNextSampleBuffer (AVAssetReaderOutput) can have very low latency. Note, however, that AVAssetReader is not intended for use with real-time sources, and its performance is not guaranteed for real-time operations.

Click Here for Apple documentation.

98 questions
1
vote
2 answers

Program crashing in Xcode with no error shown

I am in the process of writing an iPhone app, and am having a few problems with the memory. Here is the code below: NSURL *url = [curItem valueForProperty: MPMediaItemPropertyAssetURL]; AVURLAsset *asset = [AVURLAsset URLAssetWithURL: url…
coder
  • 10,460
  • 17
  • 72
  • 125
1
vote
1 answer

iPhone OpenGL-ES Video Texture

I have a feeling I'm overlooking something simple here... I have an AR application that displays a 3D object upon marker detection. The object is simply a flat 3d rectangle - which I am able to bind image textures to without issue. However, I need…
1
vote
1 answer

How to apply Vision Framework to Video Playback

I only found examples mainly using the live camera capture to apply the vision framework, which I already have working. I also want to apply the body pose detection and drawing upon video playback. I have the following code which already plays back…
1
vote
0 answers

Is there any function to extract all the frames of a video that is downloaded and picked from Documents Directory in iOS Swift?

I am trying to extract all the frames from a video. Code is working fine for the video in Bundle Path, but it fails when i give a link of the video or I try to pick the video from File Manager. Following are the issues that i have…
1
vote
1 answer

AVAssetReader fails to initialise?

I am trying to export iCloud assets through AVAssetReader and AVAssetWriter but AVAssetReader fails to initialise using that asset. All other videos are working fine. Only iCloud shared album videos are causing trouble. The error AVAssetReader gives…
1
vote
1 answer

Using AVAssetReader and copyNextSampleBuffer without polling

I am using AVAssetReader to read audio data from a file, on a secondary thread. Every code example I have seen has at the heart of it a loop like this: while (assetReader.status == AVAssetReaderStatusReading) { // ... …
Zzyzx
  • 43
  • 5
1
vote
0 answers

kCMSampleBufferAttachmentKey_TrimDurationAtStart crash

I have the following function that takes a url of an existing video file and compresses it into an output file. I am using Avasset Reader and writter. var assetReader:AVAssetReader? var assetWriter:AVAssetWriter? func compressFile(urlToCompress:…
1
vote
1 answer

First audio CMSampleBuffer lost when reading mp4 file using AVAssetReader

I'm using AVAssetWriter to write audio CMSampleBuffer to an mp4 file, but when I later read that file using AVAssetReader, it seems to be missing the initial chunk of data. Here's the debug description of the first CMSampleBuffer passed to writer…
Grzegorz Aperliński
  • 848
  • 1
  • 10
  • 23
1
vote
1 answer

After compressing my audio file, why can I not play the file?

Audio file will not play after reducing it using AVAssetReader/ AVAssetWriter At the moment, the whole function is being executed fine, with no errors thrown. For some reason, when I go inside the document directory of the simulator via terminal,…
1
vote
0 answers

AVAssetReader , call method " startReading " fail ,return NO, Error Domain=AVFoundationErrorDomain Code=-11841 (AVErrorInvalidVideoComposition)

I read a MP4 video, frame by frame, so I use AVAssetReader , it always work ok, but 1/100 probability fail in "startReading" method. Error Domain=AVFoundationErrorDomain Code=-11841 (AVErrorInvalidVideoComposition) - (void)test{ self.reader =…
Roger
  • 11
  • 3
1
vote
0 answers

AVAssetReader failing when entering foreground again

In my app I'm processing videos with a AVAssetReader → AVAssetWriter combination. When the app is sent to the background, I pause the video writing (and thus also don't read any longer). When entering the foreground again I want to continue the…
Frank Rupprecht
  • 9,191
  • 31
  • 56
1
vote
0 answers

AVAssetReader - Can not decode MOV

I am trying to get an array of frames from a video. Here is my code: var frames = [UIImage]() let url = NSBundle.mainBundle().URLForResource(name, withExtension: ext, subdirectory: "Assets")! let asset = AVAsset(URL:…
kemkriszt
  • 280
  • 3
  • 17
1
vote
0 answers

How to decode m4a to PCM using AVFoundation's AVAsetReader

Trying to convert M4A to PCM goes well in the start. i am able to convert and read the bytes. however i am not sure if this is the correct way to do this. as i am getting 16384 bytes when i try to get the bytes in NSData. Here is my function func…
Neo
  • 1,359
  • 14
  • 34
1
vote
1 answer

iOS - Trimming mp4 on device

I thought I might be able to use an AVAssetReader/Writer to trim an MP4, but when I attempt to read the audio (haven't tried video yet), I get this: AVAssetReaderOutput does not currently support compressed output Is there any way to read an MP4 off…
Stefan Kendall
  • 66,414
  • 68
  • 253
  • 406
1
vote
1 answer

Read AVAsset into frames and compile back to video

everyone! The idea in my project is to gather a video, split it into frames, then apply specific effect frame by frame(not the topic) and then compile everything back. Using following code I am able to read the video into frames and pass them into…
tna0y
  • 1,842
  • 3
  • 16
  • 33