Tag: avfoundation

AVFoundation导出方向错误

我正在尝试将图片和video合并。 我有他们合并和出口,但它是旋转的方式。 抱歉批量代码粘贴。 我已经看到了关于应用一个转换到compositionVideoTrack.preferredTransform但是什么都不做的答案。 添加到AVMutableVideoCompositionInstruction也不会。 我觉得这个领域是事情开始出错的地方。 这儿这儿: // I feel like this loading here is the problem let videoTrack = videoAsset.tracksWithMediaType(AVMediaTypeVideo)[0] // because it makes our parentLayer and videoLayer sizes wrong let videoSize = videoTrack.naturalSize // this is returning 1920×1080, so it is rotating the video print("\(videoSize.width) , \(videoSize.height)") 所以在这里,我们的框架大小是错误的方法的其余部分。 现在,当我们尝试去创build覆盖图像层的框架是不正确的: let aLayer = CALayer() […]

警告:在正常情况下,_fillInQueueWithExtraSpace:ignoreExistingItems:不应该被重新input

这是我的class级pipe理我的video: #import "video.h" #import <MediaPlayer/MediaPlayer.h> @interface video() { MPMoviePlayerController* videoView; } @end @implementation video static video *sharedSingleton = nil; + (video *)sharedSingleton { @synchronized() { if (!sharedSingleton) sharedSingleton = [[super allocWithZone:NULL] init]; return sharedSingleton; } return nil; } – (id)init { self = [super init]; CGRect dimVideo = CGRectMake(0, 0, 472, 400); NSURL* videoPath = […]

SKVideoNode作为SCNSphere的纹理

我试图使用SKVideoNode作为我的SCNView中SCNSphere的video纹理源 我正在回答这个问题: SKVideoNode(embedded在SKScene中)作为用于场景套件节点不起作用的纹理 和我的代码(粘贴在问题的最后),我得到一个video和audio播放。 问题是,映射只发生在球体的四分之一(全xy正四分之一)。 cameraNode在sphere(0,0,0)内,并且独立于sphereNode。 我将一个缩放应用于球体节点,只是为了扭转纹理的节点: sphereNode.scale = SCNVector3Make(-1, 1, 1) 但是评论说这个没有效果。 这是所有在设备上testing(iphone 6 +,使用iOS 9.1): let sphere = SCNSphere(radius: 1) . . . func setupView() { // setup the sphere sphere.segmentCount = 55 // sphere material sceneMaterial = SCNMaterial() // setup the sphereNode sphereNode = SCNNode(geometry: sphere) sphereNode.position = SCNVector3Make(0, 0, 0) sphereNode.scale […]

AVAssetExportSession每次都失败(错误-12780)

我试图合并一些audio文件(通过MPMediaPickerController选取),但导出总是失败,错误代码-12780。 当我尝试使用AVPlayer对象播放我的作品时,它会正确播放。 只是导出失败。 我究竟做错了什么? 这是我的代码: AVAssetExportSession *exportSession; AVPlayer *player; – (void)mergeAudiofiles { // self.mediaItems is an NSArray of MPMediaItems if (self.mediaItems.count == 0) { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"No Tracks selected." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert show]; return; } // Configure audio session NSError *sessionError; AVAudioSession *session = [AVAudioSession sharedInstance]; [session setCategory:AVAudioSessionCategoryAudioProcessing error:nil]; [session […]

AVAssetExportSession给我一个输出video的右侧和底部的绿色边框

代码如下: AVAssetExportSession *exporter = [[AVAssetExportSession alloc] initWithAsset:mixComposition presetName:AVAssetExportPresetHighestQuality]; exporter.outputURL = outputUrl; exporter.outputFileType = AVFileTypeQuickTimeMovie; exporter.videoComposition = mainComposition; exporter.shouldOptimizeForNetworkUse = YES; [exporter exportAsynchronouslyWithCompletionHandler:^{ //completion }]; 我尝试了不同的质量设置。 无论我尝试渲染什么video,我都会在video的右侧沿着底部获取一个1-2像素的边框。 什么可能导致这个,我该如何解决? 编辑:我没有在任何地方使用任何种类的绿色,所以这必须以某种方式来自框架。

AVPlayer失败,AVPlayerItemStatusFailed(OSStatus错误-12983)

有时,AVPlayer失败, AVPlayerItemStatusFailed失败,AVPlayer继续失败, AVPlayerItemStatusFailed 。 我试图清除AVPlayer实例并创build一个新的,但我不能实现AVPlayerItemStatusFailed失败解决。 此外,使用AVPlayer实例removingFromSuperview UIView并使用AVPlayer初始化新项目并不能解决问题。 所以我想,AVPlayer不能完全清除。 有没有人build议尝试彻底清除AVPlayer,并使其在失败后工作? 错误日志: Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo=0x1a689360 {NSLocalizedDescription=The operation could not be completed, NSUnderlyingError=0x1a688e70 "The operation couldn't be completed. (OSStatus error -12983.)", NSLocalizedFailureReason=An unknown error occurred (-12983)} UPD。 对于@matt playerItem = [AVPlayerItem playerItemWithURL:[NSURL fileURLWithPath:filePath.path]]; if (!self.avPlayer) { avPlayer = [AVPlayer playerWithPlayerItem:playerItem]; } […]

从AVCaptureAudioDataOutputSampleBufferDelegate播放audio

我使用AVCaptureAudioDataOutputSampleBufferDelegate捕获audio _captureSession = [[AVCaptureSession alloc] init]; [self.captureSession setSessionPreset:AVCaptureSessionPresetLow]; // Setup Audio input AVCaptureDevice *audioDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeAudio]; AVCaptureDeviceInput *captureAudioInput = [AVCaptureDeviceInput deviceInputWithDevice:audioDevice error:&error]; if(error){ NSLog(@"Error Start capture Audio=%@", error); }else{ if ([self.captureSession canAddInput:captureAudioInput]){ [self.captureSession addInput:captureAudioInput]; } } // Setup Audio output AVCaptureAudioDataOutput *audioCaptureOutput = [[AVCaptureAudioDataOutput alloc] init]; if ([self.captureSession canAddOutput:audioCaptureOutput]){ [self.captureSession addOutput:audioCaptureOutput]; } [audioCaptureOutput release]; […]

video中的AVfoundation模糊背景

在我的应用程序中,我已经修复了1280 x 720的合成渲染大小。因此,如果将导入任何肖像video,那么我必须显示模糊背景填充和纵向框架的video中心。 像这样: 我实现了使用AVMtableComposition播放这两个video,但我不知道如何模糊特定的背景音轨。 我没有在我的代码中: self.composition = [AVMutableComposition composition]; AVAsset *firstAsset = [AVAsset assetWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"ScreenFlow_Blend" ofType:@"mp4"]]]; [self addAsset:firstAsset toComposition:self.composition withTrackID:1]; [self addAsset:firstAsset toComposition:self.composition withTrackID:2]; // [self addAsset:ThirdAsset toComposition:self.composition withTrackID:3]; AVAssetTrack *backVideoTrack = [firstAsset tracksWithMediaType:AVMediaTypeVideo][0];; self.videoComposition = [AVMutableVideoComposition videoComposition]; self.videoComposition.renderSize = CGSizeMake(1280, 720); self.videoComposition.frameDuration = CMTimeMake(1, 30); AVMutableVideoCompositionInstruction *instruction = [AVMutableVideoCompositionInstruction videoCompositionInstruction]; instruction.timeRange […]

iPhone可以一次快速拍摄2张照片多快?

我希望写一个iPhone应用程序,让您可以在很短的时间内连续拍摄2张照片,不知道是否可以实现。 在市场上的五月应用程序似乎只采取低分辨率仍然帧的videostream,所以我不知道如果快速捕捉全分辨率的照片是可行的。

IOS将UIProgressView添加到AVFoundation AVCaptureMovieFileOutput

我正在使用AVCaptureMovieFileOutput来录制video,我想添加一个UIProgressView来表示在video停止录制之前还剩多less时间。 我设置了15秒的最大持续时间: CMTime maxDuration = CMTimeMakeWithSeconds(15, 50); [[self movieFileOutput] setMaxRecordedDuration:maxDuration]; 我似乎无法findAVCaptureMovieFileOutput是否有一个callback,当video正在录制或开始录制。 我的问题是,如何获得录制进度的更新? 或者,如果这不是可用的东西,我怎么能告诉开始录制开始计时器?