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

Is it possible to play 2 different avplayers with the different videos?

Now I'm going to make an video app. 1) In a screen(UIview), is it possible to play 2 independent avplayers? So for example, in the left panel, one avplayer plays one video file, and in the right panel, the other avplayer plays the other video. I…
sky1224
  • 158
  • 1
  • 9
0
votes
2 answers

Why can i process a grayscale effect on AVCaptureSession and not with AVAssetReader?

I'm working on an iPhone app. I want to apply some filters on a Video from Library. After research, I started with this Post http://www.sunsetlakesoftware.com/2010/10/22/gpu-accelerated-video-processing-mac-and-ios and his ColorTracking source.…
0
votes
0 answers

SwiftUI Video Player with multiple audio channels

I have a MOV file with two audio channels. I'd like to play both simultaneously using AVKits VideoPlayer (or really any other SwiftUI compatible view component). Looking over the docs on VideoPlayer there aren't mentions of multiple streams. How…
JonLuca
  • 850
  • 6
  • 25
0
votes
0 answers

Pause video processing with AVAssetReader and AVAssetWriter

I'm processing videos with the AVAssetReader/AVAssetWriter combo. Now I have the problem that processing can't continue in the background for long when the app is suspended. The obvious solution here would be to cancel the current video export when…
Frank Rupprecht
  • 9,191
  • 31
  • 56
0
votes
0 answers

Force GPU usage with copying video sample buffers via AVAssetReader/AVSampleBufferDisplayLayer

I am looping 1 second mp4/h264 videos with no audio on an M1 Mac Mini. AVPlayer was causing hitches with scrolling. Now I read videos using AVAssetReader and feed those CMSampleBuffers into a AVSampleBufferDisplayLayer. To get it to seamlessly loop…
jnorris
  • 51
  • 1
  • 6
0
votes
0 answers

Re-encode Any Arbitrary Video File to a Single Standardized FPS, Resolution, Rotation, etc

What would be the simplest approach to re-encoding arbitrary video files chosen from a user's photo library on their iPhone to match desired parameters? Namely: 720p (aspect fill), portrait (with no transforms), 30fps, h264. Example: Given a video…
Paulo C
  • 374
  • 1
  • 5
  • 11
0
votes
1 answer

How to add a callback to AVAssetReader copyNextSampleBuffer?

I am trying to read audio frames and decode them with AVAssetReader. I want to be able to read the frames asynchronously and add some kind of callback when a sample buffer was read. So after calling: ... [reader startReading]; CMSampleBufferRef…
0
votes
0 answers

AVVideoComposition fails while trying to read video frame

I have a source video and I want to generate a new video from it by taking a region of each frame of the source video. For example, if I have a video with resolution A x B, a content size of X x Y and an output resolution of C x D, then I want to…
Reynaldo Aguilar
  • 1,906
  • 1
  • 15
  • 29
0
votes
2 answers

How to make waveform for my recorded audio?

I am using AVFoundation to record audio with the setting below. After recording successfully, I need to show the waveform of the recorded file to the user. Can anyone help me with this task? Here is my setting for recorder: let recordSettings = …
Ali Samaiee
  • 301
  • 6
  • 14
0
votes
1 answer

compressing Video Error: Terminated due to memory issue

I want to first trimming video that choose from photoLibrary, and then compress video file for custom size and bitrate. I'm using PryntTrimmerView for Trimming video, and then use trimmed video for compress video file. there is my code for trimming…
ava
  • 1,148
  • 5
  • 15
  • 44
0
votes
0 answers

How to export .aac file using AVAssetReader?

I'm using SDAVAssetExportSession to convert MPMedaiItem to .m4a file and it's working great. Link : Here This is my code, end result will be .m4a file, when in pass fileName as 1.aac this code not working. I don't know what to pass in outputFileType…
Pratik Prajapati
  • 1,137
  • 1
  • 13
  • 26
0
votes
0 answers

Reading multiple video files using "AVAssetReaderTrackOutput" simultaneously freaks out OSX

I need to read all frames from three short video files (3min each) into the memory (NSArray of CMSampleBufferRef). I used typical approach with AVAsset, AVAssetReader, AVAssetReaderTrackOutput and calling copyNextSampleBuffer in while loop. It works…
peetonn
  • 2,942
  • 4
  • 32
  • 49
0
votes
2 answers

How to merge a video,uiimage and a uiwebview in a video formate in objective c to share in social media website?

I need to merge a video,UIImage and a UIWebView in a video format in Objective-C to share in social media website. I tried AVAssetWriter but could not implement it properly. I have shown video in my UIView with MPMoviePlayerController and added a…
Pinky
  • 31
  • 5
0
votes
0 answers

How read fragmented media data in iOS

I have developed an iOS application which can records videos for long durations , i have used AVCaptureSesssion to use recording But now i want to split recorded media data according to timestamp and i thought of doing this according to following…
Mr.G
  • 1,275
  • 1
  • 18
  • 48
0
votes
1 answer

Strange data in PCM Samples from AVAssetReader

I'm extracting samples from music on an iOS device, using an AVAssetReader. Near the end of each track, I encounter some odd…
Joe
  • 726
  • 1
  • 8
  • 18