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

how to play sound by AVAssetReader

I am using AVAssetReader to get the individual frames from a video file. I would like to know how I can play the audio from Mp4 file. the return value of method [player play] is false, so there is no sound to play, but why thanks. create…
ichoyb
  • 23
  • 1
  • 7
2
votes
1 answer

AVAssetWriter fails only in iOS when writing audio from specific videos

I have a sample project for resizing videos that works well for most videos. However, AVAssetWriter fails to write the audio from specific videos with the error: Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be…
Reynaldo Aguilar
  • 1,906
  • 1
  • 15
  • 29
2
votes
1 answer

AVAssetReader, how to use with a stream rather than a file?

AVAssetReader is fantastic, but I can only see how to use it with a local asset, a file, or I guess a composition, So, assetReader = try AVAssetReader(asset: self.asset) ... assetReader.addOutput(readerOutput) and so on, Say you have an arriving…
Fattie
  • 27,874
  • 70
  • 431
  • 719
2
votes
1 answer

AVAssetReader trouble getting pixel buffer from copyNextSampleBuffer(), Swift

I'm trying to read the image frames from a Quicktime movie file using AVFoundation and AVAssetReader on macOSX. I want to display the frames via a texture map in Metal. There are many examples of using AVAssetReader online, but I cannot get it…
bsabiston
  • 721
  • 6
  • 22
2
votes
0 answers

AVFoundation decode prores4444 movie with alpha channel

I'm trying to decode a prores4444 video with alpha channel on iOS with Swift to overlay as a complex animation over a user video and to export it to his library. The AVFoundation documentation is not that great and I'm struggling to find any code…
fsoc
  • 81
  • 1
  • 5
2
votes
1 answer

Coping CMSampleBufferRef to array causes crash

I want to change the order of movie frames and then write them back to new video file. It would be much easier for me to have them all in array, but process of coping buffer samples to array causes crash on real device ( but it’s OK in simulator).…
user2262230
  • 199
  • 1
  • 3
  • 17
2
votes
1 answer

AVAssetReaderOutput memory issue

I am using AVAssetReaderOutput (more specifically AVAssetReaderTrackOutput) to process video on a frame by frame basis. I get successive frames of the video using the copyNextSampleBuffer() method. I do not maintain any references to the frames…
jbaraga
  • 656
  • 5
  • 16
2
votes
1 answer

AVAssetReader / AVAssetWriter Join mp4 file with different resolutions

I'm coding an iPad app in which I need to join mp4 file with different resolution. To do so I'm using a combination of AVAssetReader to read the mp4 source files and AVAssetWriter to write those source files in a single mp4 output file. I've tried…
JonathanGailliez
  • 1,607
  • 2
  • 15
  • 21
2
votes
0 answers

AvAssetReader getting incorrect no of audio samples

I am trying to grab the audio track from a video as raw pcm data. The plan is pass this data into a float* table array in libpd. I have managed to get some sample data but the number of samples reported is way too low. For example for a 29sec clip I…
coasty
  • 199
  • 1
  • 2
  • 11
2
votes
2 answers

AVFoundation to reproduce a video loop

I need to reproduce a video indefinitely (restarting the video when it ends) in my OpenGL application. To do so I'm trying to utilize AV foundation. I created an AVAssetReader and an AVAssetReaderTrackOutput and I utilize the copyNextSampleBuffer…
Alex79
  • 65
  • 7
2
votes
1 answer

How do I stream AVAsset audio wirelessly form one iOS device to another?

I'm making something like streaming the audio from iPod library, send the data via network or bluetooth, and playback using audio queue. Thanks for this question and code. Help me a lot. I have two question about it. what should I send from one…
lancy
  • 857
  • 6
  • 22
2
votes
2 answers

AVAssetReader to AudioQueueBuffer

Currently, I'm doing a little test project to see if I can get samples from an AVAssetReader to play back using an AudioQueue on iOS. I've read this: ( Play raw uncompressed sound with AudioQueue, no sound ) and this: ( How to correctly read…
btomw
  • 2,512
  • 2
  • 20
  • 25
2
votes
0 answers

How to record and play a captured video using AVAssertWriter and AVAssertReader in iphone sdk

I am displaying the camera data (video) on the preview layer.Now I want to record the video and store it in a local file and access it to play on the screen. I had seen some websites that it is possible with AVAssertWriter and AVAssertReader. Its…
Monish Kumar
  • 2,788
  • 4
  • 38
  • 54
1
vote
1 answer

sequentially reading video files using AVAssetReader fails in OSX Lion

I have a function to read H264 video files. I want to use it to sequentially read many video files. It seems to work for a files (random time), fails partially for a few files (reads some and not all the frames) and then completely fails (reading 0…
1
vote
2 answers

Monotouch AVAssetReader

I'm trying to convert a sample from objective C to Monotouch, and I have run into some difficulties. Basically I want to read a video file, and decode the frames one by one to an opengl texture. The key to doing this is to use the AVAssetReader, but…
sinsro
  • 905
  • 7
  • 25