avfoundation

Video rotated after applying AVVideoComposition

笑着哭i 提交于 2019-11-30 04:38:51
问题 After applying an AVVideoComposition to my AVPlayerItem , the filter I apply does work, but the video gets rotated in the AVPlayerLayer . I know for a fact that the problem is not with the filtered frame because if I show the frame in a UIImageView , the frame is rendered 100% correctly. The video shows correctly until I apply a videoComposition . Setting the videoGravity on the AVPlayerLayer does not help. The video gets rotated 90º clockwise and gets stretched in the layer. Essentially, the

AVCaptureSession stopRunning method creates terrible hang

孤街浪徒 提交于 2019-11-30 04:13:14
Using Ray Wenderlich's QRCode reader from Chapter 22 of iOS7 Tutorials , I am successfully reading QRCodes for my current app. I am now extending it that upon successfully reading a QRCode, I want to store the stringValue of the AVMetadataMachineReadableCodeObject that was read, segue to a new view, and use that data on the new view, more or less exactly how most QRCode reader apps (like RedLaser , etc...) process barcodes and QRCodes. However, I call [captureSession stopRunning] (so that it does not read any more QRCodes and trigger additional segues) and there is a 10+ second hang. I have

AVAssetWriterInput H.264 Passthrough to QuickTime (.mov) - Passing in SPS/PPS to create avcC atom?

杀马特。学长 韩版系。学妹 提交于 2019-11-30 04:07:19
I have a stream of H.264/AVC NALs consisting of types 1 (P frame), 5 (I frame), 7 (SPS), and 8 (PPS). I want to write them into an .mov file without re-encoding. I'm attempting to use AVAssetWriter to do this. The documentation for AVAssetWriterInput states: Passing nil for outputSettings instructs the input to pass through appended samples, doing no processing before they are written to the output file. This is useful if, for example, you are appending buffers that are already in a desirable compressed format. However, passthrough is currently supported only when writing to QuickTime Movie

Video Recording using AVFoundation Framework iPhone?

痞子三分冷 提交于 2019-11-30 04:06:36
I'm developing an application with the help of sample code from the WWDC 2010 AVCamDemo example. In the app I need to record a video from the front camera of iPhone, but since the new iPhone 4 is not available at my place I am not able to test the code properly. I would be really thankful if someone can give me a heads up whether I'm going in the right direction or not. The limited code I could test on my iPhone 3G (upgraded to iOS 4.1) crashes when I set the AVCaptureSession , as shown in the code below: - (void)recordVideo { NSLog(@"video recording on"); AVCaptureDevice *videoCaptureDevice =

Replay items in AVQueuePlayer after last

拜拜、爱过 提交于 2019-11-30 04:02:35
问题 I need to create something like an infinite loop in my AVQueuePlayer . Especially, I want to replay the whole NSArray of AVPlayerItem s once the last component finishes playing. I must admit that I actually do not have any idea how to achieve this and hope you can give me some clues. 回答1: best way to loop a sequence of videos in AVQueuePlayer. observe for each playeritem in AVQueuePlayer. queuePlayer.actionAtItemEnd = AVPlayerActionAtItemEndNone; for(AVPlayerItem *item in items) { [

Most memory efficient way to save a photo to disk on iPhone?

蓝咒 提交于 2019-11-30 03:40:40
From profiling with Instruments I have learned that the way I am saving images to disk is resulting in memory spikes to ~60MB . This results in the App emitting low memory warnings , which (inconsistently) leads crashes on the iPhone4S running iOS7 . I need the most efficient way to save an image to disk. I am currently using this code + (void)saveImage:(UIImage *)image withName:(NSString *)name { NSData *data = UIImageJPEGRepresentation(image, 1.0); DLog(@"*** SIZE *** : Saving file of size %lu", (unsigned long)[data length]); NSFileManager *fileManager = [NSFileManager defaultManager];

Camera differences between UIImagePickerController and AVCaptureSession on iPhone

守給你的承諾、 提交于 2019-11-30 02:28:30
I'm trying to build a replacement for UIImagePickerController , using AVCaptureSession with AVCaptureDeviceInput and AVCaptureStillImageOutput , as input/output respectively. To preview the camera stream I'm using AVCaptureVideoPreviewLayer . It's now working correctly for capturing and storing photos just like the default camera. However, I found 3 problems I was unable to solve: photos captured don't get the same quality the default camera provides the viewing/capture angle is shortened, just like using the video capture on the default camera no way to control camera specific options like

Caching with AVPlayer and AVAssetExportSession

纵然是瞬间 提交于 2019-11-30 02:24:55
I would like to cache progressive-download videos using AVPlayer. How can I save an AVPlayer's item to disk? I'm trying to use AVAssetExportSession on the player's currentItem (which is fully loaded). This code is giving me " AVAssetExportSessionStatusFailed (The operation could not be completed) " : AVAsset *mediaAsset = self.player.currentItem.asset; AVAssetExportSession *es = [[AVAssetExportSession alloc] initWithAsset:mediaAsset presetName:AVAssetExportPresetLowQuality]; NSString *outPath = [NSTemporaryDirectory() stringByAppendingPathComponent:@"out.mp4"]; NSFileManager *fileManager =

How can I extract an AVMetadataObject from a UIImage?

£可爱£侵袭症+ 提交于 2019-11-30 02:14:00
I'd like to use iOS 7's new barcode scanning functionality with a UIImage instead of live capture from one of the device's camera. I already have the detection working fine with an AVCaptureDeviceInput . The best way I think to do this would be to create a concrete subclass of AVCaptureInput that provides media data to an AVCaptureSession from a UIImage . However, I can't find any documentation or examples on how to subclass AVCaptureInput , so I'm at a loss. An alternative would be to override the media stream from an existing AVCaptureDeviceInput , but since those API's are private and I'd

How to record video of screen like Talking Tom Cat on iPhone?

匆匆过客 提交于 2019-11-30 02:10:42
I want to know if there is any public API in AVFoundation or any other framework which can be used to record screen like Talking Tom Cat does. I looked into AVFoundation and CoreVideo frameworks but could not find anything from the header files. If anyone knows how to record screen video prgramatically using iPhone SDK, let me know. harshalb you can do it in the following steps: capture screen take that frame in a queue write it with avassertwriter and export the video there is a sample application for understanding these things in the wwdc2010 sample code. hope this helps.(sample app name :