avfoundation

AVFileCaptureOutput: Not recording at 240 fps

帅比萌擦擦* 提交于 2019-12-11 01:33:40
问题 I seem to be having a problem where I am setting the camera to record at 240 FPS, but for some reason the output file is only 30 FPS. Here is my code for setting up the camera (this is instantiated first): class HFRCamera { public: HFRCamera(); AVCaptureDeviceInput *camera; AVCaptureDeviceInput *microphone; AVCaptureDevice *videoCam; AVCaptureDevice *audioInput; AVCaptureSession *capSession; void start(); void config(); void stop(); }; HFRCamera::HFRCamera() { // Set up capture session and

How to get AVPlayer to redraw current AVItem videoComposition when paused

会有一股神秘感。 提交于 2019-12-11 00:27:29
问题 I'm building a simple video editor for macOS: A movie file is loaded as an AVAsset, transformed by a series of CIFilters in a AVVideoComposition, and played by an AVPlayer. I present UI controls for some of the parameters of the CIFilters. When video is playing everything is working great, I slide sliders and effects change! But when the video is paused the AVPlayerView doesn't redraw after the controls in the UI are changed. How can I encourage the AVPlayerView to redraw the contents of the

iOS app camera orientation in captureOutput

纵饮孤独 提交于 2019-12-11 00:17:24
问题 First, I know many people asked similar question - but I couldn't find any question that is similar. When calling this interface: - (void) captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection { CVImageBufferRef pixelBuffer = CMSampleBufferGetImageBuffer(sampleBuffer); CVPixelBufferLockBaseAddress(pixelBuffer, 0); // get buffer dimensions size_t bufferHeight = CVPixelBufferGetHeight(pixelBuffer);

AVAudioRecorder and audio data file offset of wav audio file

天涯浪子 提交于 2019-12-10 23:44:13
问题 wav file afinfo command give the audio data offset as 4096, Is there any way to change data offset to 44 on macOS or iOS using AVFoundation my setting as follows func exportSettings() -> Dictionary <String, Any> { var recordingSetting :[String:Any] = [AVLinearPCMBitDepthKey: 16, AVNumberOfChannelsKey : 1, AVSampleRateKey : 16_000, AVLinearPCMIsBigEndianKey : 0, AVLinearPCMIsFloatKey : 0] recordingSetting[AVFormatIDKey] = Int(kAudioFormatLinearPCM) recordingSetting[AVChannelLayoutKey] = NSData

AVAssetExportSession missing audio track when exporting on device

白昼怎懂夜的黑 提交于 2019-12-10 23:14:10
问题 I run the export on the simulator and everything works great. I run it on the device and the video gets exported but there's no audio. This leads me to believe that I must be using an audio format that the device doesn't support but OS X does, as the simulator uses what OS X uses. I've tried m4a, aiff, and aifc and have had no luck! Any ideas?? 回答1: I have a very similar problem. It does not seem to do with codecs, as I made a separate test case that runs fine with the same video. There’s a

Playing WAV data with AVAudioEngine

…衆ロ難τιáo~ 提交于 2019-12-10 22:17:33
问题 Currently, I'm getting an EXC_BAD_ACCESS error on the audio thread, and I'm trying to deduce what is going wrong. When converting .wav file data from Data to an AVAudioPCMBuffer , do I need to strip the RIFF header first? import AVFoundation public class Player : NSObject { let engine = AVAudioEngine() public override init() { super.init() do { let _ = engine.mainMixerNode try engine.start() } catch { print("Player error: \(error)") } } @objc public func play(_ data: Data) { let format =

AVAssetWriter queue guidance Swift 3

耗尽温柔 提交于 2019-12-10 21:50:48
问题 can anyone give me some guidance on using Queues in AVFoundation please? Later on in my app I want to do some processing on individual frames so I need to use AVCaptureVideoDataOutput. To get started I thought I'd capture images and then write them (unprocessed) using AVAssetWriter. I am successfully streaming frames from camera to image preview by setting up an AVCapture session as follows: func initializeCameraAndMicrophone() { // set up the captureSession captureSession = AVCaptureSession(

iOS: bug in AVPlayerItem when receiving `304 Not Modified` response

只谈情不闲聊 提交于 2019-12-10 21:50:47
问题 This is a very weird bug. I have a tableView with each cell using an AVPlayer to stream a video from a remote server (think a Vine-like timeline). So when I scroll, the cells that get reused reconfigure their player with the new video. The problem is: if I scroll back and forth very fast, getting the same video in and out of the screen, the request sent by the AVPlayer eventually changes, to include the HTTP Headers If-None-Match and If-Modified-Since , which are not there the rest of the

AVFoundation to overlay an alpha channel video on another video?

坚强是说给别人听的谎言 提交于 2019-12-10 20:27:23
问题 I have tried to overlay an image on a video asset and also thought of there should be some way to overlay an alpha channel video on another video. Is there any way to overlay an alpha channel video on another video asset? 来源: https://stackoverflow.com/questions/17909906/avfoundation-to-overlay-an-alpha-channel-video-on-another-video

Pausing and serializing an AVAssetExportSession

三世轮回 提交于 2019-12-10 20:27:01
问题 I'm trying to export several minutes of video in an AVAssetExportSession and it's taking a long time. My ideal way of doing this is pausing the AVAssetExportSession when the app closes and resuming it when the app reopens. Is there any way to pause an AVAssetExportSession, save its state, and reload it later? 来源: https://stackoverflow.com/questions/44812343/pausing-and-serializing-an-avassetexportsession