Dive into the technical aspects of audio on your device, including codecs, format support, and customization options.

Audio Documentation

Posts under Audio subtopic

Post

Replies

Boosts

Views

Activity

AVCaptureDevice devices array doesn't show apple TV
Hi,I would like to capture a screen of my Apple TV device connected to my Mac (10.11.4) via USB cable.When I choose New Movie Recording in QuickTime Player I can see and choose Apple TV as Camera & Audio input sources.When I try to do the same through[AVCaptureDevice devices]I can see only my external camera. How do I set the Apple TV as a capture session input source? What is the way to do it?Thanks,Nava
1
0
859
Jun ’22
Synchronize Multiple iOS Cameras, ms Precision
Does anyone know if it's possible to control WHEN the video captureoutput loop collects the camera image? I'd like to synchronize multiple iOS cameras to within a certain sub ms precision for an application that covers fast action. And this particular use would have to sync the images within a certain tolerance of time under 1ms. Think of it as a network based gen-lock signal.Thanks,
2
0
2.4k
Apr ’23
Scan multiple 1 D barcodes
HiIs it possible to scan multiple 1D barcodes using the Apple APIs provided? I can only seem to scan multiple QR codes but when I try 1 D barcodes I only ever get one result, the code is as follows- (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputMetadataObjects:(NSArray *)metadataObjects fromConnection:(AVCaptureConnection *)connection { CGRect highlightViewRect = CGRectZero; AVMetadataMachineReadableCodeObject *barCodeObject; NSString *detectionString = nil; NSArray *barCodeTypes = @[AVMetadataObjectTypeUPCECode, AVMetadataObjectTypeCode39Code, AVMetadataObjectTypeCode39Mod43Code, AVMetadataObjectTypeEAN13Code, AVMetadataObjectTypeEAN8Code, AVMetadataObjectTypeCode93Code, AVMetadataObjectTypeCode128Code, AVMetadataObjectTypePDF417Code, AVMetadataObjectTypeQRCode, AVMetadataObjectTypeAztecCode]; for (AVMetadataObject *metadata in metadataObjects) { for (NSString *type in barCodeTypes) { if ([metadata.type isEqualToString:type]) { barCodeObject = (AVMetadataMachineReadableCodeObject *)[_prevLayer transformedMetadataObjectForMetadataObject:(AVMetadataMachineReadableCodeObject *)metadata]; highlightViewRect = barCodeObject.bounds; detectionString = [(AVMetadataMachineReadableCodeObject *)metadata stringValue]; break; } } if (detectionString != nil) { _label.text = detectionString; break; } else _label.text = @"(none)"; } _highlightView.frame = highlightViewRect; }
1
0
887
May ’23
UIImage don't show as MPMediaItemPropertyArtwork
This is on Xcode Version 7.3.1 (7D1014) on OS X 10.11.5 (15F34), target is an iOS application, built for iOS 9.I have an audio application in which I cannot manage to show the cover art in Now Playing lock screen.I can show a static image and other information but I'm not able to show the "real" album cover. Code below works correctly (a 512x512 image is displayed: NSMutableDictionary __block *mpInfo = [[NSMutableDictionary alloc] initWithDictionary:[[MPNowPlayingInfoCenter defaultCenter] nowPlayingInfo]]; mpInfo[MPMediaItemPropertyArtist] = currentSong.artist; mpInfo[MPMediaItemPropertyTitle] = currentSong.title; if([[RP4RadioManager sharedManager] isPlaying]) { mpInfo[MPNowPlayingInfoPropertyPlaybackRate] = @(1.0); } else { mpInfo[MPNowPlayingInfoPropertyPlaybackRate] = @(0.0); } mpInfo[MPMediaItemPropertyPlaybackDuration] = @([currentSong.duration doubleValue] / 1000.0); mpInfo[MPNowPlayingInfoPropertyElapsedPlaybackTime] = @(0); mpInfo[MPMediaItemPropertyArtwork] = [[MPMediaItemArtwork alloc] initWithImage:[UIImage imageNamed:@"BigLogo"]]; [[MPNowPlayingInfoCenter defaultCenter] setNowPlayingInfo:mpInfo];some rows below I recover the cover art from the network and I try to show it: coverImage = [[UIImage alloc] initWithCIImage:currentSong.coverImage]; MPMediaItemArtwork *imageArtwork = [[MPMediaItemArtwork alloc] initWithImage:coverImage]; mpInfo[MPMediaItemPropertyArtwork] = imageArtwork; DLog(@"Setting cover info. Image: %@, imageArtwork: %@ (%@). mpInfo: %@", coverImage, imageArtwork, NSStringFromCGRect(imageArtwork.bounds), mpInfo); dispatch_async(dispatch_get_main_queue(), ^{ [[MPNowPlayingInfoCenter defaultCenter] setNowPlayingInfo:mpInfo]; });The image is valid (usually 500x500px, but this don't seems significant). The image is originally a .jpg, saved in a CIImage (for OS X comaptibility in common code) and then loaded in a UIImage (the same image shows correctly in a UIImageView).Changing the linempInfo[MPMediaItemPropertyArtwork] = imageArtwork;withmpInfo[MPMediaItemPropertyArtwork] = [[MPMediaItemArtwork alloc] initWithImage:[UIImage imageNamed:@"no_cover"]];shows a different static image, so the problem is in the original image but I really cannot understand what the problem is... the log line shows an image and a valid MPMeidaItemArtworkSetting cover info. Image: <UIImage: 0x14eaeed0>, {500, 500}, imageArtwork: <MPMediaItemArtwork: 0x14eaef00> ({{0, 0}, {500, 500}}). mpInfo: { MPNowPlayingInfoPropertyElapsedPlaybackTime = 0; MPNowPlayingInfoPropertyPlaybackRate = 1; albumTitle = "Radio Paradise"; artist = "Other Lives"; artwork = "<MPMediaItemArtwork: 0x14eaef00>"; playbackDuration = "242.8"; title = "Tamer Animals"; }I suspect it's something really stupid but I don't really know how to debug that.Any help/hint will be appreciated.
2
0
3.7k
Sep ’21
v3 Audio Units and Sidechain on iOS & OSX
I've looked around the documentation and searched a bit on google and I'm curious if it possible to have a sidechain input using the v3 Audio Units API in both iOS and OSX. I would like to be able to instantiate a plug-in on one track and select another track to manipulate the Audio Units effect on the first track. If so I was wondering where I might find documentation on this.
4
0
3.7k
Mar ’22
AVAudioInputNode Audio Tap Removal
Hi all I am currently working on an iOS 10 app so not all of you may know the answer to my question. My main problem has been dealing with the new Speech Recognition API that is being introduced in iOS 10. Currently to get speech recognition started you must install an audio tap on one of iOS's audio busses using AVAudioInputNode (quite the long sentence I know). For some reason when calling the method that removes audio taps on a certain bus is not actually doing anything. I've tried moving this code between the top and bottom of the recognition task's completion block. This results in my app crashing when speech recognition begins. Here's the code I use to remove the bus below:[self.audioEngine stop]; [self.recognitionRequest endAudio]; [self.audioEngine.inputNode removeTapOnBus:0]; self.recognitionRequest = nil; self.recognitionTask = nil;Also another thing of note, I'm using Xcode 8 beta 6. If any of you can help me with this, thank you in advance.
2
0
1.4k
Apr ’22
Can i continue record video when user put application on background mode?
Hi,I have an application that uses AVCaptureSession to record the video (from front camera) and write it to file.When i put an application on background mode i start recieve exception:AVFoundationErrorDomain Code = -11847 "Opetation Interrupted".When getting back on foreground, still recieving this exception.The questions is - can i continue record video when user put application on background mode? If yes, how should i implement it?If no, is there way to at least pause the recording and continue it to the same file.Thanks,Nikita.
5
0
8.6k
Sep ’21
AVPlayerItem buffer duration not respected
I am trying to set preferredForwardBufferDuration property on AVPlayerItem and haven't been able to get it to work. No matter what non zero value I set, AVPlayer proceeds to buffer the entire file (mp3)Does this mean, preferredForwardBufferDuration only works for HLS and not progressive download files? If so, is there any other way to control buffer on AVPlayer level?
10
0
11k
Sep ’22
How to preserve kCMFormatDescriptionExtension_FieldXXX after encoding?
I am currently working with AVAssetWriterInput with interlaced source.I want to know the proper procedure to preserve 'fiel' format description extension through AVAssetWriterInput compression operation.Do you anyone have an answer on this?>>Technical Note TN2162>>Uncompressed Y´CbCr Video in QuickTime Files>>The 'fiel' ImageDescription Extension: Field/Frame Information//What I have tried is following:First decode into sample buffer with Field/Frame information- Decode DV-NTSC source and get current FieldCount/Detail of source data- Create a kCVPixelFormatType_422YpCbCr8 CVImageBuffer from source- CMSetAttachments() kCVImageBufferFieldCountKey/kCVImageBufferFieldDetailKey with FieldCount=2/FieldDetail=14 to imageBuffer, same as DV-NTSC source- CMVideoFormatDescriptionCreateForImageBuffer()- CMSampleBufferCreateForImageBuffer()- Now decompressed samplebuffer has kCMFormatDescriptionExtension_FieldXXX same as sourceSecond encode using ProRes422- Next I create AVAssetWriterInput to transcode from _422YpCbCr8 into AVVideoCodecAppleProRes422- Now AVAssetWriter can produce ProRes422 mov file, but it does not contain the format description extension 'fiel'.- ProRes422 Encoder does preserve 'colr', 'pasp', 'clap' same as source, but no 'fiel' is there.I have also tried to serve format description with kCMFormatDescriptionExtension_FieldXXX with initWithMediaType:outputSettings:sourceFormatHint:but no success.//
1
0
1k
Oct ’23
AVAudioEngine crash - required condition is false: hwFormat
Hi,We recently started using AVAudioEngine in our app, and are receiving reports of crashes in the wild, specifically: com.apple.coreaudio.avfaudio required condition is false: hwFormatThese crashes are occurring on all iOS versions, including the latest (10.0.2 14A456).The crashes are always on a background thread. Here is one example stack trace:(CoreFoundation + 0x0012f1c0 ) __exceptionPreprocess (libobjc.A.dylib + 0x00008558 ) objc_exception_throw (CoreFoundation + 0x0012f090 ) +[NSException raise:format:arguments:] (AVFAudio + 0x00016788 ) AVAE_RaiseException(NSString*, ...) (AVFAudio + 0x0008f168 ) AVAudioIOUnit::_GetHWFormat(unsigned int, unsigned int*) (AVFAudio + 0x0008ee64 ) ___ZN13AVAudioIOUnit22IOUnitPropertyListenerEPvP28OpaqueAudioComponentInstancejjj_block_invoke_2 (libdispatch.dylib + 0x000011fc ) _dispatch_call_block_and_release (libdispatch.dylib + 0x000011bc ) _dispatch_client_callout (libdispatch.dylib + 0x0000f440 ) _dispatch_queue_serial_drain (libdispatch.dylib + 0x000049a4 ) _dispatch_queue_invoke (libdispatch.dylib + 0x00011388 ) _dispatch_root_queue_drain (libdispatch.dylib + 0x000110e8 ) _dispatch_worker_thread3 (libsystem_pthread.dylib + 0x000012c4 ) _pthread_wqthread (libsystem_pthread.dylib + 0x00000db0 ) start_wqthreadWhen this crash occurs, the main thread is generally responding to an audio route change. Here is one example stack trace:(libsystem_kernel.dylib + 0x0000116c ) mach_msg_trap (libsystem_kernel.dylib + 0x00000fd8 ) mach_msg (libdispatch.dylib + 0x0001cac0 ) _dispatch_mach_msg_send (libdispatch.dylib + 0x0001c214 ) _dispatch_mach_send_drain (libdispatch.dylib + 0x0001d414 ) _dispatch_mach_send_push_and_trydrain (libdispatch.dylib + 0x000174a8 ) _dispatch_mach_send_msg (libdispatch.dylib + 0x000175cc ) dispatch_mach_send_with_result (libxpc.dylib + 0x00002c80 ) _xpc_connection_enqueue (libxpc.dylib + 0x00003cf0 ) xpc_connection_send_message_with_reply (MediaRemote + 0x00011edc ) MRMediaRemoteServiceGetPickedRouteHasVolumeControl (MediaPlayer + 0x0009d57c ) -[MPAVRoutingController _pickableRoutesDidChangeNotification:] (CoreFoundation + 0x000c9228 ) __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ (CoreFoundation + 0x000c892c ) _CFXRegistrationPost (CoreFoundation + 0x000c86a8 ) ___CFXNotificationPost_block_invoke (CoreFoundation + 0x00137b98 ) -[_CFXNotificationRegistrar find:object:observer:enumerator:] (CoreFoundation + 0x0000abf0 ) _CFXNotificationPost (Foundation + 0x000066b8 ) -[NSNotificationCenter postNotificationName:object:userInfo:] (MediaServices + 0x00003100 ) -[MSVDistributedNotificationObserver _handleDistributedNotificationWithNotifyToken:] (MediaServices + 0x00002f10 ) __78-[MSVDistributedNotificationObserver initWithDistributedName:localName:queue:]_block_invoke (libsystem_notify.dylib + 0x00009ea4 ) ___notify_dispatch_local_notification_block_invoke (libdispatch.dylib + 0x000011fc ) _dispatch_call_block_and_release (libdispatch.dylib + 0x000011bc ) _dispatch_client_callout (libdispatch.dylib + 0x00005d68 ) _dispatch_main_queue_callback_4CF (CoreFoundation + 0x000dcf28 ) __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ (CoreFoundation + 0x000dab14 ) __CFRunLoopRun (CoreFoundation + 0x00009044 ) CFRunLoopRunSpecific (GraphicsServices + 0x0000c194 ) GSEventRunModal (UIKit + 0x0007b624 ) -[UIApplication _run] (UIKit + 0x0007635c ) UIApplicationMainThis looks like the same issue as https://forums.developer.apple.com/message/36184#36184One potential complication is that we are calling AVAudioEngine methods off of the main thread. My belief is that this is safe - but I can't find any official reference to confirm that it is. We find that AVAudioEngine method calls can block, which is why we moved the work off the main thread.We are listening for audio engine configuration change notifications and handling them similarly to the AVAudioEngine sample code.I have attempted to reproduce this issue locally by performing various actions in combination (receiving phone calls, suspending the app, plugging in or unplugging headphones, etc) with no luck.Any thoughts on what conditions might be triggering this exception? Hopefully, I can at least narrow down a set of conditions to allow me to reproduce the crash in a controlled environment.Thanks,Rob
8
0
15k
May ’23
How to capture frames from a video using generateCGImagesAsynchronously()
Hello,I am trying to capture frames from a video and I'm currently using generateCGImagesAsynchronously(). The problem is that each frame is captured at 0.0s, 1.0s, 2.0s, 3.0s ... But I really want to capture it at 0.0s, 0.2s, 0.4s ...Here is my codeif let path = Bundle.main.path(forResource: "video", ofType:"MOV") { let fileUrl = NSURL(fileURLWithPath: path) let asset = AVURLAsset(url: (fileUrl as URL), options: nil) let videoDuration = asset.duration let generator = AVAssetImageGenerator(asset: asset) var frameForTimes = [NSValue]() let sampleCounts = 20 let totalTimeLength = Int(videoDuration.seconds * Double(videoDuration.timescale)) let step = totalTimeLength / sampleCounts for i in 0 ..< sampleCounts { let cmTime = CMTimeMake(Int64(i * step), Int32(videoDuration.timescale)) frameForTimes.append(NSValue(time: cmTime)) } generator.generateCGImagesAsynchronously(forTimes: frameForTimes, completionHandler: {requestedTime, image, actualTime, result, error in DispatchQueue.main.async { if let image = image { print(requestedTime.value, requestedTime.seconds, actualTime.value) self.frames.append(UIImage(cgImage: image)) } } }) }The timescale is 600 and actualTime.value is always at 0, 601, 1202, 1802 ... It seems that it is only taking frames at an integer seconds (0, 1, 2, 3 ...)Is there a way to capture frames at non-integer seconds using generateCGImagesAsynchronously()? For example: 0.2s, 0.4s?Or should I look into other APIs?Thank you,Jass
3
0
5.6k
May ’22
Raw RGB (in DNG) and hidden exposure compensation
Hello,I am currently working on the rear camera sensor of an iPhone and I have noticed a strange behavior with exposure settings and raw RGB data (in DNG). The same problem occurs with both iPhone 6S and iPhone 7 on iOS 10.0.1 and Xcode 8.I made two experiments :- In the first, I set manual shutter speed and manual ISO (with setExposureModeCustomWithDuration:ISO: ) and sometimes the luminosity of the picture changes (which should not occur as exposure parameters are fixed)- In the second, I want to check the linearity of raw RGB according to ISO (exposure duration is blocked). At the begining everything is almost perfectly linear but when I increase ISO to a certain value, raw RGB do not change (though they are far from being saturated) while in photos the luminous shifts are present as expected. I have found out that this information is stored in the DNG EXIF data in the Baseline Exposure (BLE) tag. When I correct those RGB with this exposure shift (using 2^BLE, the formula that I believe to be correct), I lose the linearity between RGB and ISO, which is a big problem for me. In addition to this, the tone curve in DNG file is perfectly linear which I believe is wrong in the latter case.I believe that the two problems are correlated and that in both cases the camera does a hidden exposure compensation. Is there a way to block this behavior and if not, will it be possible to know what is happening in the sensor?Best regards,
2
0
2.1k
Sep ’21
AVPlayer seeking and periodicTimeObservers
Hi all,We are using AVPlayer to play our audio only HLS streams and are seeing what looks like a threading issue with the currentTime() method on AVPlayer vs the times reported by using the periodicTimeObserver.Here's the scenario:1. A class registers as a periodicTimeObserver using 0.1 seconds as the desired time interval.2. Lets say the current time (as reported to the periodic observer) reaches 8.8 seconds.3. On a separate thread, we have the player seek to the currentTime() + 2 seconds.4. Within the completion block of the call to seek, we read & report what the new currentTime() is5. While this is happening, you still listen to the periodicTimeObserver callbacks.6. You'll notice the time reported by the call to currentTime() within the seek completion block is actually AFTER the currentTime() as reported by the periodicTimeObserver.Here it is in code:let underlyingPlayer: AVQueuePlayer = ... underlyingPlayer.seek(to: newPosition, toleranceBefore: kCMTimeZero, toleranceAfter: kCMTimeZero, completionHandler: { [weak self] success in let time = underlyingPlayer.currentTime print("After seeking, the current time is \(time)") completionHandler?(error, time) }) // periodic time observer is set up as the following with an interval of 0.1 seconds let underlyingTimeObservingQueue = DispatchQueue(label: "com.company.player.timeObserver.queue", qos: DispatchQoS.userInitiated) let valueInterval = CMTimeMakeWithSeconds(interval, 1000) return underlyingPlayer.addPeriodicTimeObserver(forInterval: valueInterval, queue: underlyingTimeObservingQueue) { time in print("periodic time is \(CMTimeGetSeconds(time))") return block(CMTimeGetSeconds(time)) } }When you run this, here's the output we receive:periodicTime is 7.701181537periodicTime is 7.801130009periodicTime is 7.900316636periodicTime is 8.000758814periodicTime is 8.100601498periodicTime is 8.201145766periodicTime is 8.301150409periodicTime is 8.401138697periodicTime is 8.501144148periodicTime is 8.601161655periodicTime is 8.701154072periodicTime is 8.800160082After seeking, the current time is 10.88 <----------------- This is the result returned by the seek call's completion blockperiodicTime is 10.736309528periodicTime is 10.736393196periodicTime is 10.801075743periodicTime is 10.900429325periodicTime is 11.000907073periodicTime is 11.100982256periodicTime is 11.201173809periodicTime is 11.300147113periodicTime is 11.401182831periodicTime is 11.500769324periodicTime is 11.600593684periodicTime is 11.701193966periodicTime is 11.800258566periodicTime is 11.900176181periodicTime is 12.000423167This seems like a bug within AVPlayer, but wanted to check here before filing it.We couldn't really find any workarounds for this, but here's what we tried so far:1. Unregistering all periodicTimeObservers right before seeking, and adding them back in the seek completion handler2. Dispatch_sync the call to currentTime() within the seek method's completion blockHowever, none of these solutions fixed the problem.Does anyone have any ideas about what's going on?
4
1
4.0k
Feb ’22
Paused Avplayer resumes when app comes to foreground
IOS 10.0I am using AvPlayer to play mp3 files hosted on Internet. In my app I am calling avplayer.pause() to explicity pause the content and the content pauses. Then I press the "home" button on the phone to move the app to the background and I cannot hear content. So far so good. (I have following set in plist to enable background audio mode). <key>UIBackgroundModes</key> <array> <string>audio</string> </array>Now when I click on the app again, the observer I have set on avPlayer and avPlayer.currentItem gets triggered automatically in following order:AvPlayerItem status goes to "Ready To Play"AvPlayer reports rate = 1... and the audio starts playing automatically!!!!which is not the expected behavior nor desired user experience.I tried doing avplayer.pause() using some checks in AppDelegate.applicationWillEnterForeground but that doesn't help either. Looks like iOS itself is trying to resume session.Can't seem to figure out how to stop this. Found this thread on stackoverflow: http://stackoverflow.com/questions/17526221/paused-audio-starts-playing-automatically-on-applicationwillenterforegroundbut I think recommendations there are not correct.Any help is truly appreciated!
5
0
5k
Oct ’21
Video produced with AVCaptureMovieFileOutput is different than preview layer at high zoom factors when stabilization is turned on
I've noticed that when using an AVCaptureVideoPreviewLayer zoomed very far in (videoZoomFactor ~130) while also enabling either standard or cinematic video stabilization, that the preview is very different from what's present in the asset created with AVCaptureMovieFileOutput. The movie file is always offset much higher than what I was focusing on in the preview layer.This doesn't happen when stabilization is off, and it happens even when on a tripod (hence the only movement is the act of zooming itself). I'm not sure if this is a bug or something expected with stabilization on, but I would have expected AVCaptureVideoPreviewLayer to be a relatively accurate representation of what I'm recording.Is this a bug, or something I should be able to correct for? Is there some inherent innaccuracy in AVCaptureVideoPreviewLayer?
1
2
663
Feb ’23
AVPlayer not playing m3u8 from local file
I am trying to get AVPlayer to play a m3u8 playlist that is a local file.I have narrowed this down to a simple test case using one of Apple's sample playlists:https://tungsten.aaplimg.com/VOD/bipbop_adv_fmp4_example/master.m3u8If i play this playlist from the remote url, AVPlayer plays this fine. However, if i download this playlist to a local file, and then hand AVPlayer the local file URL, AVPlayer will not play it. It just shows the crossed out play symbol.Interestingly enough, this can be duplicated with Safari as well. Safari will play the remote playlist but not the local file. Also of note is that this behavior of AVPlayer is identical on iOS 10.2 as well as macOS 10.12.1. Also, playing an mp4 media file directly (not wrapped in a playlist) does not seem to have this issue, as it plays both from a remote URL as well as from a local file.Inspecting the AVPlayerItem.error does not lead to anything useful either:An unknown error occurred (-12865) The operation could not be completed Is anyone aware of any limitation that AVPlayer would not play a local playlist?Thank you.
5
0
13k
Aug ’21
How to set hog mode using core audio
Hi friends, Im creating a program where i need to take exclusive control over the soundcard (mac osx), and from reading up I understand this should be possible using core audio, but after some hours searching around I havent found any easy way to do this. Is there some sort of property I can set on an Audio unit or AUGraph, or am i going about this the wrong way?BRGDSAlexander Östman
1
0
2.2k
Mar ’22
Recreating AUParameterTree without destroying the tree object? Is it possible?
I have a situation where at any one time my AudioUnit can be represented by only a few parameters or literally many 100s.This dynamic situation is under the control of the user and the maximum number of parameters and their hierarchy cannot be predicted in advance. ( at least not accurately ).When the parameters are to change I am setting the parameterTree property by creating a new tree with the child nodes and posting KVC notifications ….. create childGroups … [self willChangeValueForKey:@"parameterTree"]; self.parameterTree = [AUParameterTree createTreeWithChildren: childGroups ]; [self didChangeValueForKey:@"parameterTree"];Most the of the app’s User Interface and AudioUnit is coded in Swift, the engine is in coded in C/C++ with an objectiveC AUAudioUnit class that acts as the go between hence the above.However there is a popular host app that crashes when I do this and it looks like the host is hanging on to the parameterTree object that’s it’s passed originally when the AU first launches but never updates it even after the KVC notifications are posted.So after that long explanation… Am I doing this correctly? OR Is there a solution that can create and rebuild a tree without making a new AUParameterTree object?If I can do that the host in question may not crash, ( although it might anyway because all the parameters have changed ).I have posted a code example to the host developer but sadly got a response which gave me the impression he was not prepared to work on a fix.Thanks!
11
0
3.2k
Dec ’21
How do you convert and audio file from two (2) channels (stereo) to one channel (1)?
Currently, I'm recording audio on the Apple Watch using the presentAudioRecorderController and sending it to the corresponding iPhone app.The audio format by default seems to be recorded on the Apple Watch using two channels and there doesn't seem to be a way to change that.For various reasons, I need the audio format to be only one channel. I was hoping there would be something on iOS to convert the audio file from stereo (two channels) to mono (one channel)Right now, I'm investigating if this is possible using AVAudioEngine and other various related classes. I'm not sure if it's possible and it seems very complicated at the moment.
3
0
2.6k
Jun ’23
AVSampleBufferDisplayLayer fails to decode with error -8969
I'm writing a player app that will play back HLS live streams, and ran into a curious error when trying to enqueue CMSampleBuffers into an AVSampleBufferDisplayLayer.What I am doing:1. Take NALUs from the stream and strip out the SPS, PPS information to construct a CMFormatDescription2. For VCL type NALUs, replace the starter bytes with a 4-byte length.3. Wrap the NALUs into CMBlockBuffer4. Wrap the CMBlockBuffer, along with the CMFormatDescription, into CMSampleBuffers( What I had done originally:5. Use a VTDecompressionSession to decompress the CMSampleBuffers into CVImageBuffers6. Display CVImageBuffers using CAEAGLayer rendering code found here.)When I had the player written to use the entire video processing pipeline above (steps #1 through #6), it worked just fine playing HLS live streams. Now, what I'm trying to do now is to enqueue the CMSampleBuffers generated in step #4 directly into an AVSampleBufferDisplay layer to decompress and display (replacing steps #5 and #6).When I enqueue each CMSampleBuffer, AVSampleBufferDisplayLayerStatus = Rendering, but it also generated a notification that it failed to decode:Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo={AVErrorMediaSubTypeKey=( 1635148593 ), NSLocalizedFailureReason=An unknown error occurred (-8969), NSUnderlyingError=0x600000046870 {Error Domain=NSOSStatusErrorDomain Code=-8969 "(null)"}, AVErrorMediaTypeKey=vide, AVErrorPresentationTimeStampKey=CMTime: {642749/90000 = 7.142}, NSLocalizedDescription=The operation could not be completed}What could cause an error code -11800 / -8969?
3
1
2.4k
Mar ’23
AVCaptureDevice devices array doesn't show apple TV
Hi,I would like to capture a screen of my Apple TV device connected to my Mac (10.11.4) via USB cable.When I choose New Movie Recording in QuickTime Player I can see and choose Apple TV as Camera & Audio input sources.When I try to do the same through[AVCaptureDevice devices]I can see only my external camera. How do I set the Apple TV as a capture session input source? What is the way to do it?Thanks,Nava
Replies
1
Boosts
0
Views
859
Activity
Jun ’22
Synchronize Multiple iOS Cameras, ms Precision
Does anyone know if it's possible to control WHEN the video captureoutput loop collects the camera image? I'd like to synchronize multiple iOS cameras to within a certain sub ms precision for an application that covers fast action. And this particular use would have to sync the images within a certain tolerance of time under 1ms. Think of it as a network based gen-lock signal.Thanks,
Replies
2
Boosts
0
Views
2.4k
Activity
Apr ’23
Scan multiple 1 D barcodes
HiIs it possible to scan multiple 1D barcodes using the Apple APIs provided? I can only seem to scan multiple QR codes but when I try 1 D barcodes I only ever get one result, the code is as follows- (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputMetadataObjects:(NSArray *)metadataObjects fromConnection:(AVCaptureConnection *)connection { CGRect highlightViewRect = CGRectZero; AVMetadataMachineReadableCodeObject *barCodeObject; NSString *detectionString = nil; NSArray *barCodeTypes = @[AVMetadataObjectTypeUPCECode, AVMetadataObjectTypeCode39Code, AVMetadataObjectTypeCode39Mod43Code, AVMetadataObjectTypeEAN13Code, AVMetadataObjectTypeEAN8Code, AVMetadataObjectTypeCode93Code, AVMetadataObjectTypeCode128Code, AVMetadataObjectTypePDF417Code, AVMetadataObjectTypeQRCode, AVMetadataObjectTypeAztecCode]; for (AVMetadataObject *metadata in metadataObjects) { for (NSString *type in barCodeTypes) { if ([metadata.type isEqualToString:type]) { barCodeObject = (AVMetadataMachineReadableCodeObject *)[_prevLayer transformedMetadataObjectForMetadataObject:(AVMetadataMachineReadableCodeObject *)metadata]; highlightViewRect = barCodeObject.bounds; detectionString = [(AVMetadataMachineReadableCodeObject *)metadata stringValue]; break; } } if (detectionString != nil) { _label.text = detectionString; break; } else _label.text = @"(none)"; } _highlightView.frame = highlightViewRect; }
Replies
1
Boosts
0
Views
887
Activity
May ’23
UIImage don't show as MPMediaItemPropertyArtwork
This is on Xcode Version 7.3.1 (7D1014) on OS X 10.11.5 (15F34), target is an iOS application, built for iOS 9.I have an audio application in which I cannot manage to show the cover art in Now Playing lock screen.I can show a static image and other information but I'm not able to show the "real" album cover. Code below works correctly (a 512x512 image is displayed: NSMutableDictionary __block *mpInfo = [[NSMutableDictionary alloc] initWithDictionary:[[MPNowPlayingInfoCenter defaultCenter] nowPlayingInfo]]; mpInfo[MPMediaItemPropertyArtist] = currentSong.artist; mpInfo[MPMediaItemPropertyTitle] = currentSong.title; if([[RP4RadioManager sharedManager] isPlaying]) { mpInfo[MPNowPlayingInfoPropertyPlaybackRate] = @(1.0); } else { mpInfo[MPNowPlayingInfoPropertyPlaybackRate] = @(0.0); } mpInfo[MPMediaItemPropertyPlaybackDuration] = @([currentSong.duration doubleValue] / 1000.0); mpInfo[MPNowPlayingInfoPropertyElapsedPlaybackTime] = @(0); mpInfo[MPMediaItemPropertyArtwork] = [[MPMediaItemArtwork alloc] initWithImage:[UIImage imageNamed:@"BigLogo"]]; [[MPNowPlayingInfoCenter defaultCenter] setNowPlayingInfo:mpInfo];some rows below I recover the cover art from the network and I try to show it: coverImage = [[UIImage alloc] initWithCIImage:currentSong.coverImage]; MPMediaItemArtwork *imageArtwork = [[MPMediaItemArtwork alloc] initWithImage:coverImage]; mpInfo[MPMediaItemPropertyArtwork] = imageArtwork; DLog(@"Setting cover info. Image: %@, imageArtwork: %@ (%@). mpInfo: %@", coverImage, imageArtwork, NSStringFromCGRect(imageArtwork.bounds), mpInfo); dispatch_async(dispatch_get_main_queue(), ^{ [[MPNowPlayingInfoCenter defaultCenter] setNowPlayingInfo:mpInfo]; });The image is valid (usually 500x500px, but this don't seems significant). The image is originally a .jpg, saved in a CIImage (for OS X comaptibility in common code) and then loaded in a UIImage (the same image shows correctly in a UIImageView).Changing the linempInfo[MPMediaItemPropertyArtwork] = imageArtwork;withmpInfo[MPMediaItemPropertyArtwork] = [[MPMediaItemArtwork alloc] initWithImage:[UIImage imageNamed:@"no_cover"]];shows a different static image, so the problem is in the original image but I really cannot understand what the problem is... the log line shows an image and a valid MPMeidaItemArtworkSetting cover info. Image: <UIImage: 0x14eaeed0>, {500, 500}, imageArtwork: <MPMediaItemArtwork: 0x14eaef00> ({{0, 0}, {500, 500}}). mpInfo: { MPNowPlayingInfoPropertyElapsedPlaybackTime = 0; MPNowPlayingInfoPropertyPlaybackRate = 1; albumTitle = "Radio Paradise"; artist = "Other Lives"; artwork = "<MPMediaItemArtwork: 0x14eaef00>"; playbackDuration = "242.8"; title = "Tamer Animals"; }I suspect it's something really stupid but I don't really know how to debug that.Any help/hint will be appreciated.
Replies
2
Boosts
0
Views
3.7k
Activity
Sep ’21
v3 Audio Units and Sidechain on iOS & OSX
I've looked around the documentation and searched a bit on google and I'm curious if it possible to have a sidechain input using the v3 Audio Units API in both iOS and OSX. I would like to be able to instantiate a plug-in on one track and select another track to manipulate the Audio Units effect on the first track. If so I was wondering where I might find documentation on this.
Replies
4
Boosts
0
Views
3.7k
Activity
Mar ’22
AVAudioInputNode Audio Tap Removal
Hi all I am currently working on an iOS 10 app so not all of you may know the answer to my question. My main problem has been dealing with the new Speech Recognition API that is being introduced in iOS 10. Currently to get speech recognition started you must install an audio tap on one of iOS's audio busses using AVAudioInputNode (quite the long sentence I know). For some reason when calling the method that removes audio taps on a certain bus is not actually doing anything. I've tried moving this code between the top and bottom of the recognition task's completion block. This results in my app crashing when speech recognition begins. Here's the code I use to remove the bus below:[self.audioEngine stop]; [self.recognitionRequest endAudio]; [self.audioEngine.inputNode removeTapOnBus:0]; self.recognitionRequest = nil; self.recognitionTask = nil;Also another thing of note, I'm using Xcode 8 beta 6. If any of you can help me with this, thank you in advance.
Replies
2
Boosts
0
Views
1.4k
Activity
Apr ’22
Can i continue record video when user put application on background mode?
Hi,I have an application that uses AVCaptureSession to record the video (from front camera) and write it to file.When i put an application on background mode i start recieve exception:AVFoundationErrorDomain Code = -11847 "Opetation Interrupted".When getting back on foreground, still recieving this exception.The questions is - can i continue record video when user put application on background mode? If yes, how should i implement it?If no, is there way to at least pause the recording and continue it to the same file.Thanks,Nikita.
Replies
5
Boosts
0
Views
8.6k
Activity
Sep ’21
AVPlayerItem buffer duration not respected
I am trying to set preferredForwardBufferDuration property on AVPlayerItem and haven't been able to get it to work. No matter what non zero value I set, AVPlayer proceeds to buffer the entire file (mp3)Does this mean, preferredForwardBufferDuration only works for HLS and not progressive download files? If so, is there any other way to control buffer on AVPlayer level?
Replies
10
Boosts
0
Views
11k
Activity
Sep ’22
How to preserve kCMFormatDescriptionExtension_FieldXXX after encoding?
I am currently working with AVAssetWriterInput with interlaced source.I want to know the proper procedure to preserve 'fiel' format description extension through AVAssetWriterInput compression operation.Do you anyone have an answer on this?>>Technical Note TN2162>>Uncompressed Y´CbCr Video in QuickTime Files>>The 'fiel' ImageDescription Extension: Field/Frame Information//What I have tried is following:First decode into sample buffer with Field/Frame information- Decode DV-NTSC source and get current FieldCount/Detail of source data- Create a kCVPixelFormatType_422YpCbCr8 CVImageBuffer from source- CMSetAttachments() kCVImageBufferFieldCountKey/kCVImageBufferFieldDetailKey with FieldCount=2/FieldDetail=14 to imageBuffer, same as DV-NTSC source- CMVideoFormatDescriptionCreateForImageBuffer()- CMSampleBufferCreateForImageBuffer()- Now decompressed samplebuffer has kCMFormatDescriptionExtension_FieldXXX same as sourceSecond encode using ProRes422- Next I create AVAssetWriterInput to transcode from _422YpCbCr8 into AVVideoCodecAppleProRes422- Now AVAssetWriter can produce ProRes422 mov file, but it does not contain the format description extension 'fiel'.- ProRes422 Encoder does preserve 'colr', 'pasp', 'clap' same as source, but no 'fiel' is there.I have also tried to serve format description with kCMFormatDescriptionExtension_FieldXXX with initWithMediaType:outputSettings:sourceFormatHint:but no success.//
Replies
1
Boosts
0
Views
1k
Activity
Oct ’23
AVAudioEngine crash - required condition is false: hwFormat
Hi,We recently started using AVAudioEngine in our app, and are receiving reports of crashes in the wild, specifically: com.apple.coreaudio.avfaudio required condition is false: hwFormatThese crashes are occurring on all iOS versions, including the latest (10.0.2 14A456).The crashes are always on a background thread. Here is one example stack trace:(CoreFoundation + 0x0012f1c0 ) __exceptionPreprocess (libobjc.A.dylib + 0x00008558 ) objc_exception_throw (CoreFoundation + 0x0012f090 ) +[NSException raise:format:arguments:] (AVFAudio + 0x00016788 ) AVAE_RaiseException(NSString*, ...) (AVFAudio + 0x0008f168 ) AVAudioIOUnit::_GetHWFormat(unsigned int, unsigned int*) (AVFAudio + 0x0008ee64 ) ___ZN13AVAudioIOUnit22IOUnitPropertyListenerEPvP28OpaqueAudioComponentInstancejjj_block_invoke_2 (libdispatch.dylib + 0x000011fc ) _dispatch_call_block_and_release (libdispatch.dylib + 0x000011bc ) _dispatch_client_callout (libdispatch.dylib + 0x0000f440 ) _dispatch_queue_serial_drain (libdispatch.dylib + 0x000049a4 ) _dispatch_queue_invoke (libdispatch.dylib + 0x00011388 ) _dispatch_root_queue_drain (libdispatch.dylib + 0x000110e8 ) _dispatch_worker_thread3 (libsystem_pthread.dylib + 0x000012c4 ) _pthread_wqthread (libsystem_pthread.dylib + 0x00000db0 ) start_wqthreadWhen this crash occurs, the main thread is generally responding to an audio route change. Here is one example stack trace:(libsystem_kernel.dylib + 0x0000116c ) mach_msg_trap (libsystem_kernel.dylib + 0x00000fd8 ) mach_msg (libdispatch.dylib + 0x0001cac0 ) _dispatch_mach_msg_send (libdispatch.dylib + 0x0001c214 ) _dispatch_mach_send_drain (libdispatch.dylib + 0x0001d414 ) _dispatch_mach_send_push_and_trydrain (libdispatch.dylib + 0x000174a8 ) _dispatch_mach_send_msg (libdispatch.dylib + 0x000175cc ) dispatch_mach_send_with_result (libxpc.dylib + 0x00002c80 ) _xpc_connection_enqueue (libxpc.dylib + 0x00003cf0 ) xpc_connection_send_message_with_reply (MediaRemote + 0x00011edc ) MRMediaRemoteServiceGetPickedRouteHasVolumeControl (MediaPlayer + 0x0009d57c ) -[MPAVRoutingController _pickableRoutesDidChangeNotification:] (CoreFoundation + 0x000c9228 ) __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ (CoreFoundation + 0x000c892c ) _CFXRegistrationPost (CoreFoundation + 0x000c86a8 ) ___CFXNotificationPost_block_invoke (CoreFoundation + 0x00137b98 ) -[_CFXNotificationRegistrar find:object:observer:enumerator:] (CoreFoundation + 0x0000abf0 ) _CFXNotificationPost (Foundation + 0x000066b8 ) -[NSNotificationCenter postNotificationName:object:userInfo:] (MediaServices + 0x00003100 ) -[MSVDistributedNotificationObserver _handleDistributedNotificationWithNotifyToken:] (MediaServices + 0x00002f10 ) __78-[MSVDistributedNotificationObserver initWithDistributedName:localName:queue:]_block_invoke (libsystem_notify.dylib + 0x00009ea4 ) ___notify_dispatch_local_notification_block_invoke (libdispatch.dylib + 0x000011fc ) _dispatch_call_block_and_release (libdispatch.dylib + 0x000011bc ) _dispatch_client_callout (libdispatch.dylib + 0x00005d68 ) _dispatch_main_queue_callback_4CF (CoreFoundation + 0x000dcf28 ) __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ (CoreFoundation + 0x000dab14 ) __CFRunLoopRun (CoreFoundation + 0x00009044 ) CFRunLoopRunSpecific (GraphicsServices + 0x0000c194 ) GSEventRunModal (UIKit + 0x0007b624 ) -[UIApplication _run] (UIKit + 0x0007635c ) UIApplicationMainThis looks like the same issue as https://forums.developer.apple.com/message/36184#36184One potential complication is that we are calling AVAudioEngine methods off of the main thread. My belief is that this is safe - but I can't find any official reference to confirm that it is. We find that AVAudioEngine method calls can block, which is why we moved the work off the main thread.We are listening for audio engine configuration change notifications and handling them similarly to the AVAudioEngine sample code.I have attempted to reproduce this issue locally by performing various actions in combination (receiving phone calls, suspending the app, plugging in or unplugging headphones, etc) with no luck.Any thoughts on what conditions might be triggering this exception? Hopefully, I can at least narrow down a set of conditions to allow me to reproduce the crash in a controlled environment.Thanks,Rob
Replies
8
Boosts
0
Views
15k
Activity
May ’23
How to capture frames from a video using generateCGImagesAsynchronously()
Hello,I am trying to capture frames from a video and I'm currently using generateCGImagesAsynchronously(). The problem is that each frame is captured at 0.0s, 1.0s, 2.0s, 3.0s ... But I really want to capture it at 0.0s, 0.2s, 0.4s ...Here is my codeif let path = Bundle.main.path(forResource: "video", ofType:"MOV") { let fileUrl = NSURL(fileURLWithPath: path) let asset = AVURLAsset(url: (fileUrl as URL), options: nil) let videoDuration = asset.duration let generator = AVAssetImageGenerator(asset: asset) var frameForTimes = [NSValue]() let sampleCounts = 20 let totalTimeLength = Int(videoDuration.seconds * Double(videoDuration.timescale)) let step = totalTimeLength / sampleCounts for i in 0 ..< sampleCounts { let cmTime = CMTimeMake(Int64(i * step), Int32(videoDuration.timescale)) frameForTimes.append(NSValue(time: cmTime)) } generator.generateCGImagesAsynchronously(forTimes: frameForTimes, completionHandler: {requestedTime, image, actualTime, result, error in DispatchQueue.main.async { if let image = image { print(requestedTime.value, requestedTime.seconds, actualTime.value) self.frames.append(UIImage(cgImage: image)) } } }) }The timescale is 600 and actualTime.value is always at 0, 601, 1202, 1802 ... It seems that it is only taking frames at an integer seconds (0, 1, 2, 3 ...)Is there a way to capture frames at non-integer seconds using generateCGImagesAsynchronously()? For example: 0.2s, 0.4s?Or should I look into other APIs?Thank you,Jass
Replies
3
Boosts
0
Views
5.6k
Activity
May ’22
Raw RGB (in DNG) and hidden exposure compensation
Hello,I am currently working on the rear camera sensor of an iPhone and I have noticed a strange behavior with exposure settings and raw RGB data (in DNG). The same problem occurs with both iPhone 6S and iPhone 7 on iOS 10.0.1 and Xcode 8.I made two experiments :- In the first, I set manual shutter speed and manual ISO (with setExposureModeCustomWithDuration:ISO: ) and sometimes the luminosity of the picture changes (which should not occur as exposure parameters are fixed)- In the second, I want to check the linearity of raw RGB according to ISO (exposure duration is blocked). At the begining everything is almost perfectly linear but when I increase ISO to a certain value, raw RGB do not change (though they are far from being saturated) while in photos the luminous shifts are present as expected. I have found out that this information is stored in the DNG EXIF data in the Baseline Exposure (BLE) tag. When I correct those RGB with this exposure shift (using 2^BLE, the formula that I believe to be correct), I lose the linearity between RGB and ISO, which is a big problem for me. In addition to this, the tone curve in DNG file is perfectly linear which I believe is wrong in the latter case.I believe that the two problems are correlated and that in both cases the camera does a hidden exposure compensation. Is there a way to block this behavior and if not, will it be possible to know what is happening in the sensor?Best regards,
Replies
2
Boosts
0
Views
2.1k
Activity
Sep ’21
AVPlayer seeking and periodicTimeObservers
Hi all,We are using AVPlayer to play our audio only HLS streams and are seeing what looks like a threading issue with the currentTime() method on AVPlayer vs the times reported by using the periodicTimeObserver.Here's the scenario:1. A class registers as a periodicTimeObserver using 0.1 seconds as the desired time interval.2. Lets say the current time (as reported to the periodic observer) reaches 8.8 seconds.3. On a separate thread, we have the player seek to the currentTime() + 2 seconds.4. Within the completion block of the call to seek, we read & report what the new currentTime() is5. While this is happening, you still listen to the periodicTimeObserver callbacks.6. You'll notice the time reported by the call to currentTime() within the seek completion block is actually AFTER the currentTime() as reported by the periodicTimeObserver.Here it is in code:let underlyingPlayer: AVQueuePlayer = ... underlyingPlayer.seek(to: newPosition, toleranceBefore: kCMTimeZero, toleranceAfter: kCMTimeZero, completionHandler: { [weak self] success in let time = underlyingPlayer.currentTime print("After seeking, the current time is \(time)") completionHandler?(error, time) }) // periodic time observer is set up as the following with an interval of 0.1 seconds let underlyingTimeObservingQueue = DispatchQueue(label: "com.company.player.timeObserver.queue", qos: DispatchQoS.userInitiated) let valueInterval = CMTimeMakeWithSeconds(interval, 1000) return underlyingPlayer.addPeriodicTimeObserver(forInterval: valueInterval, queue: underlyingTimeObservingQueue) { time in print("periodic time is \(CMTimeGetSeconds(time))") return block(CMTimeGetSeconds(time)) } }When you run this, here's the output we receive:periodicTime is 7.701181537periodicTime is 7.801130009periodicTime is 7.900316636periodicTime is 8.000758814periodicTime is 8.100601498periodicTime is 8.201145766periodicTime is 8.301150409periodicTime is 8.401138697periodicTime is 8.501144148periodicTime is 8.601161655periodicTime is 8.701154072periodicTime is 8.800160082After seeking, the current time is 10.88 <----------------- This is the result returned by the seek call's completion blockperiodicTime is 10.736309528periodicTime is 10.736393196periodicTime is 10.801075743periodicTime is 10.900429325periodicTime is 11.000907073periodicTime is 11.100982256periodicTime is 11.201173809periodicTime is 11.300147113periodicTime is 11.401182831periodicTime is 11.500769324periodicTime is 11.600593684periodicTime is 11.701193966periodicTime is 11.800258566periodicTime is 11.900176181periodicTime is 12.000423167This seems like a bug within AVPlayer, but wanted to check here before filing it.We couldn't really find any workarounds for this, but here's what we tried so far:1. Unregistering all periodicTimeObservers right before seeking, and adding them back in the seek completion handler2. Dispatch_sync the call to currentTime() within the seek method's completion blockHowever, none of these solutions fixed the problem.Does anyone have any ideas about what's going on?
Replies
4
Boosts
1
Views
4.0k
Activity
Feb ’22
Paused Avplayer resumes when app comes to foreground
IOS 10.0I am using AvPlayer to play mp3 files hosted on Internet. In my app I am calling avplayer.pause() to explicity pause the content and the content pauses. Then I press the "home" button on the phone to move the app to the background and I cannot hear content. So far so good. (I have following set in plist to enable background audio mode). <key>UIBackgroundModes</key> <array> <string>audio</string> </array>Now when I click on the app again, the observer I have set on avPlayer and avPlayer.currentItem gets triggered automatically in following order:AvPlayerItem status goes to "Ready To Play"AvPlayer reports rate = 1... and the audio starts playing automatically!!!!which is not the expected behavior nor desired user experience.I tried doing avplayer.pause() using some checks in AppDelegate.applicationWillEnterForeground but that doesn't help either. Looks like iOS itself is trying to resume session.Can't seem to figure out how to stop this. Found this thread on stackoverflow: http://stackoverflow.com/questions/17526221/paused-audio-starts-playing-automatically-on-applicationwillenterforegroundbut I think recommendations there are not correct.Any help is truly appreciated!
Replies
5
Boosts
0
Views
5k
Activity
Oct ’21
Video produced with AVCaptureMovieFileOutput is different than preview layer at high zoom factors when stabilization is turned on
I've noticed that when using an AVCaptureVideoPreviewLayer zoomed very far in (videoZoomFactor ~130) while also enabling either standard or cinematic video stabilization, that the preview is very different from what's present in the asset created with AVCaptureMovieFileOutput. The movie file is always offset much higher than what I was focusing on in the preview layer.This doesn't happen when stabilization is off, and it happens even when on a tripod (hence the only movement is the act of zooming itself). I'm not sure if this is a bug or something expected with stabilization on, but I would have expected AVCaptureVideoPreviewLayer to be a relatively accurate representation of what I'm recording.Is this a bug, or something I should be able to correct for? Is there some inherent innaccuracy in AVCaptureVideoPreviewLayer?
Replies
1
Boosts
2
Views
663
Activity
Feb ’23
AVPlayer not playing m3u8 from local file
I am trying to get AVPlayer to play a m3u8 playlist that is a local file.I have narrowed this down to a simple test case using one of Apple's sample playlists:https://tungsten.aaplimg.com/VOD/bipbop_adv_fmp4_example/master.m3u8If i play this playlist from the remote url, AVPlayer plays this fine. However, if i download this playlist to a local file, and then hand AVPlayer the local file URL, AVPlayer will not play it. It just shows the crossed out play symbol.Interestingly enough, this can be duplicated with Safari as well. Safari will play the remote playlist but not the local file. Also of note is that this behavior of AVPlayer is identical on iOS 10.2 as well as macOS 10.12.1. Also, playing an mp4 media file directly (not wrapped in a playlist) does not seem to have this issue, as it plays both from a remote URL as well as from a local file.Inspecting the AVPlayerItem.error does not lead to anything useful either:An unknown error occurred (-12865) The operation could not be completed Is anyone aware of any limitation that AVPlayer would not play a local playlist?Thank you.
Replies
5
Boosts
0
Views
13k
Activity
Aug ’21
How to set hog mode using core audio
Hi friends, Im creating a program where i need to take exclusive control over the soundcard (mac osx), and from reading up I understand this should be possible using core audio, but after some hours searching around I havent found any easy way to do this. Is there some sort of property I can set on an Audio unit or AUGraph, or am i going about this the wrong way?BRGDSAlexander Östman
Replies
1
Boosts
0
Views
2.2k
Activity
Mar ’22
Recreating AUParameterTree without destroying the tree object? Is it possible?
I have a situation where at any one time my AudioUnit can be represented by only a few parameters or literally many 100s.This dynamic situation is under the control of the user and the maximum number of parameters and their hierarchy cannot be predicted in advance. ( at least not accurately ).When the parameters are to change I am setting the parameterTree property by creating a new tree with the child nodes and posting KVC notifications ….. create childGroups … [self willChangeValueForKey:@"parameterTree"]; self.parameterTree = [AUParameterTree createTreeWithChildren: childGroups ]; [self didChangeValueForKey:@"parameterTree"];Most the of the app’s User Interface and AudioUnit is coded in Swift, the engine is in coded in C/C++ with an objectiveC AUAudioUnit class that acts as the go between hence the above.However there is a popular host app that crashes when I do this and it looks like the host is hanging on to the parameterTree object that’s it’s passed originally when the AU first launches but never updates it even after the KVC notifications are posted.So after that long explanation… Am I doing this correctly? OR Is there a solution that can create and rebuild a tree without making a new AUParameterTree object?If I can do that the host in question may not crash, ( although it might anyway because all the parameters have changed ).I have posted a code example to the host developer but sadly got a response which gave me the impression he was not prepared to work on a fix.Thanks!
Replies
11
Boosts
0
Views
3.2k
Activity
Dec ’21
How do you convert and audio file from two (2) channels (stereo) to one channel (1)?
Currently, I'm recording audio on the Apple Watch using the presentAudioRecorderController and sending it to the corresponding iPhone app.The audio format by default seems to be recorded on the Apple Watch using two channels and there doesn't seem to be a way to change that.For various reasons, I need the audio format to be only one channel. I was hoping there would be something on iOS to convert the audio file from stereo (two channels) to mono (one channel)Right now, I'm investigating if this is possible using AVAudioEngine and other various related classes. I'm not sure if it's possible and it seems very complicated at the moment.
Replies
3
Boosts
0
Views
2.6k
Activity
Jun ’23
AVSampleBufferDisplayLayer fails to decode with error -8969
I'm writing a player app that will play back HLS live streams, and ran into a curious error when trying to enqueue CMSampleBuffers into an AVSampleBufferDisplayLayer.What I am doing:1. Take NALUs from the stream and strip out the SPS, PPS information to construct a CMFormatDescription2. For VCL type NALUs, replace the starter bytes with a 4-byte length.3. Wrap the NALUs into CMBlockBuffer4. Wrap the CMBlockBuffer, along with the CMFormatDescription, into CMSampleBuffers( What I had done originally:5. Use a VTDecompressionSession to decompress the CMSampleBuffers into CVImageBuffers6. Display CVImageBuffers using CAEAGLayer rendering code found here.)When I had the player written to use the entire video processing pipeline above (steps #1 through #6), it worked just fine playing HLS live streams. Now, what I'm trying to do now is to enqueue the CMSampleBuffers generated in step #4 directly into an AVSampleBufferDisplay layer to decompress and display (replacing steps #5 and #6).When I enqueue each CMSampleBuffer, AVSampleBufferDisplayLayerStatus = Rendering, but it also generated a notification that it failed to decode:Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo={AVErrorMediaSubTypeKey=( 1635148593 ), NSLocalizedFailureReason=An unknown error occurred (-8969), NSUnderlyingError=0x600000046870 {Error Domain=NSOSStatusErrorDomain Code=-8969 "(null)"}, AVErrorMediaTypeKey=vide, AVErrorPresentationTimeStampKey=CMTime: {642749/90000 = 7.142}, NSLocalizedDescription=The operation could not be completed}What could cause an error code -11800 / -8969?
Replies
3
Boosts
1
Views
2.4k
Activity
Mar ’23