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
4
votes
1 answer

When reading frames from a video on an iPad with AVAssetReader, the images are not properly oriented

A few things I want to establish first: This works properly on multiple iPhones (iOS 10.3 & 11.x) This works properly on any iPad simulator (iOS 11.x) What I am left with is a situation where when I run the following code (condensed from my…
CodeBender
  • 35,668
  • 12
  • 125
  • 132
4
votes
1 answer

How to read a timecode track with AVAsset and Swift 3?

I'd like to read the time value of a timecode track. There is an excellent documentation from Apple (see Technical Note 2310) but it's written in Objective C. I have translated the core logic to Swift 3. It works exactly as the ObjC version, which…
4
votes
0 answers

copyNextSampleBuffer returns NULL when reading two-video-track movie second time

I have a movie with two video tracks. I need to read frames from the two tracks interleaved - that is, one frame from track 1, then one frame from track 2, then from track 1 and so on. I'm using an AVAsset with two AVAssetReaders to read the frames…
YgVz
  • 41
  • 2
4
votes
1 answer

AVAssetReader/AVAssetWriter preview of current frame

I'm using AVAssetReader/AVAssetWriter to convert my video on iOS. My question is: what's the most efficient way to show preview of current frame with real time conversion. I was thinking about converting CMSampleBufferRef to UIImage, then applying…
user3128673
  • 663
  • 1
  • 5
  • 6
4
votes
2 answers

AVAsset not recognising NSURL - Crashing - iOS

I am making an iOS app. One of its features is that it can save record and save audio files. In order to save the URL's of the recorded audio files, I storing them in NSUserDefaults as filePaths like…
Supertecnoboff
  • 6,406
  • 11
  • 57
  • 98
4
votes
3 answers

How to control video frame rate with AVAssetReader and AVAssetWriter?

We are trying to understand how to control/specify the frame rate for videos that we are encoding with AVAssetReader and AVAssetWriter. Specifically, we are are using AVAssetReader and AVAssetWriter to transcode/encode/compress a video that we have…
Chris Markle
  • 2,076
  • 4
  • 25
  • 46
4
votes
1 answer

scrubbing with AVAssetReader

I have implemented seeking as discussed here ( AVAssetReader Seeking), however there is of course a noticeable delay while the AVAssetReader is torn down and a new one constructed (since you cannot change the timeRange property once you have begun…
yano
  • 4,095
  • 3
  • 35
  • 68
4
votes
1 answer

play 200fps video on 30fps on iOS

i'am looking for the possibility to play a video @200fps in slow motion (30fps) on the iPhone. MPMediaPlayer is no solution. the video (600frames ~3 sec) plays in 2 sec. I would like 30fps ~ 20 sec. i have set the…
3
votes
0 answers

AVAssetReaderTrackOutput copynextsamplebuffer || always NULL after return from background

This is familiar with my question but I didn't understand the answer: copyNextSampleBuffer after application returns from background on iPhone I'm just trying to use an AVAssetReaderTrackOutput to read a video: CMSampleBufferRef sampleBuffer =…
Max
  • 2,699
  • 2
  • 27
  • 50
3
votes
1 answer

How does one obtain image buffers in their original format from a video stream using AVFoundation?

In Apple's documentation for AVAssetReaderTrackOutput, it indicates the following about the parameter for outputSettings when instantiating an instance using +[AVAssetReaderTrackOutput assetReaderTrackOutputWithTrack:outputSettings:] A value of nil…
Dan
  • 1,258
  • 1
  • 10
  • 22
3
votes
0 answers

iOS how to insert background for an existing video

I need to make a background for an existing video. The background should be a pre-provided image (png type). Summary, I have an existing video and an existing image. How can I make the image as the background for the video? I need exactly that…
vietstone
  • 8,784
  • 16
  • 52
  • 79
3
votes
1 answer

Exporting with AVAssetReaderVideoCompositionOutput goes partway and then exits with AVFoundationErrorDomain Code=-11800

I've built an AVMutableComposition and VideoComposition from AVAssets and am able to play it. I am also able to export it using AVAssetExportSession, however AVAssetExportSession does not offer much control of the settings, so I'm exporting it using…
Bjorn Roche
  • 11,279
  • 6
  • 36
  • 58
3
votes
0 answers

decoding h.264 frame data in using AVAssetReader iOS

I have some questions on AVAssetReader. Currently I am reading view data sent from the IP Camera using the API provided by them. From the API, the following will return from the API for each frame 1.Buffer contain frame raw data 2.Frame type I or B…
JosephT
  • 865
  • 1
  • 11
  • 20
3
votes
1 answer

.m4a raw data from iPod Library not playing

So I am faced with a very weird and strange problem and was wondering if anyone else has come across this issue. I am grabbing the raw data from MPMediaItem from the phones music library and then sending it out via HTTP to be played elsewhere. Where…
Krzemienski
  • 1,185
  • 13
  • 28
2
votes
0 answers

AVAssetReaderAudioMixOutput with multiple files?

I have 2 WAV files (mono) I would like to merge. I want to merge them into a stereo WAV file where the first file will use the left channel while the second file will use the right channel (if possible, I would also like to control the volume and…
Gilad Novik
  • 4,546
  • 4
  • 41
  • 58