• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Using AVSampleRateKey in outputSettings for AVAssetReaderTrackOutput
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using AVSampleRateKey in outputSettings for AVAssetReaderTrackOutput


  • Subject: Re: Using AVSampleRateKey in outputSettings for AVAssetReaderTrackOutput
  • From: Tibor Horvath <email@hidden>
  • Date: Tue, 15 Jan 2013 12:14:51 -0800

>> AVLinearPCMBitDepthKey
Should be 16 for integer

And make sure to set number of channels.

Regards,
Tibor

On 2013-01-15, at 12:00 PM, email@hidden wrote:

>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 15 Jan 2013 15:05:15 +0000
> From: Simon Haycock <email@hidden>
> To: email@hidden
> Subject: RE: Using AVSampleRateKey in outputSettings for
>    AVAssetReaderTrackOutput
> Message-ID:
>    <email@hidden>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi again.
>
> Little bump. Anyone had any experience with the below? It would be great to
> have an AVFoundation.framework to try out, in case mine is old/buggy...
>
> Many thanks
>
> Simon
>
> ------------------------------
>>
>> Message: 3
>> Date: Sat, 12 Jan 2013 14:17:51 +0000
>> From: Simon Haycock <email@hidden>
>> To: email@hidden
>> Subject: Using AVSampleRateKey in outputSettings for
>>        AVAssetReaderTrackOutput
>> Message-ID: <email@hidden>
>> Content-Type: text/plain; charset=us-ascii
>>
>> Hi Guys.
>>
>> I have had a good poke around regarding this issue, and I am stumped. I
>> get an NSInvalidArguementException when setting the value for
>> AVSampleRateKey in the outputSettings dictionary when adding a track to an
>> AVAssetReaderTrackOutput. The comment in the console is:
>>
>> '*** -[AVAssetReaderTrackOutput initWithTrack:outputSettings:]
>> AVAssetReaderTrackOutput does not currently support AVSampleRateKey,
>> AVNumberOfChannelsKey, or AVChannelLayoutKey'
>>
>> If I comment out the setting of AVSampleRateKey, the
>> AVAssetReaderTrackOutput is initialised fine, and getting PCM data from the
>> AVAssetReader and subsequently playing those samples out to speakers works
>> as it should without any issues. But if I load a .wav / .mp3 at a different
>> sample rate to the hardware sample rate, the audio is obviously heard
>> slower / faster than it should be, therefore I want to be able to set
>> AVSampleRateKey so that sample rate conversion occurs when loading the PCM
>> data. Should setting the AVSampleRateKey allow this to happen?
>>
>> Interestingly, in the older documentation (from around 1 year ago), the
>> AVAssetReaderTrackOutput reference states exactly the same comment about
>> not currently supporting those keys which are mentioned in the console
>> output (the old doc, by some strange chance, is here:
>> http://disanji.net/iOS_Doc/#documentation/AVFoundation/Reference/AVAssetReaderTrackOutput_Class/Reference/Reference.html). After I updated Xcode to 4.5.2 (and subsequently the documentation), the
>> comment in the AVAssetReaderTrackOutput reference regarding lack of support
>> for AVSampleRateKey is no longer there (
>> https://developer.apple.com/library/mac/#documentation/AVFoundation/Reference/AVAssetReaderTrackOutput_Class/Reference/Reference.html#//apple_ref/doc/uid/TP40009691).
>> However, the changes made seem to imply more ambiguity as to what should
>> work, and what should not.
>>
>> I have seen several other examples where people have set the
>> AVSampleRateKey with no problems, so I am wondering if it's just me. Any
>> chance someone who has successfully performed a sample rate conversion in a
>> read scenario using AVAssetReader can send me their AVFoundation.framework?
>> It may just be my framework that is out of date...
>>
>> Here are the rest of my audio read settings and subsequent AVFoundation
>> calls. :
>> audioReadSettings = [[NSMutableDictionary alloc] initWithObjectsAndKeys:
>>                         [NSNumber numberWithInt:kAudioFormatLinearPCM],
>> AVFormatIDKey,
>>                         [NSNumber numberWithInt:(32)],
>> AVLinearPCMBitDepthKey,   // 32 bits per sample
>>                         [NSNumber numberWithBool:NO],
>> AVLinearPCMIsBigEndianKey,
>>                         [NSNumber numberWithBool:YES],
>> AVLinearPCMIsFloatKey,
>>                         [NSNumber numberWithBool:NO],
>> AVLinearPCMIsNonInterleaved,
>>                         /* [NSNumber numberWithFloat:44100.0],
>> AVSampleRateKey, */ // currently not supported
>>                         nil];
>> NSURL *fileURL = [NSURL fileURLWithPath:absolutePath]; // absolute path is
>> the path of my audio file/
>> audioAsset = [AVURLAsset URLAssetWithURL:fileURL options:[NSDictionary
>> dictionaryWithObject:[NSNumber numberWithBool:YES]
>> forKey:AVURLAssetPreferPreciseDurationAndTimingKey]];
>> trackArray = [[audioAsset tracksWithMediaType:AVMediaTypeAudio] retain];
>> track = [[trackArray objectAtIndex:0] retain];
>> AVAssetReaderTrackOutput *readerOutput = [[AVAssetReaderTrackOutput alloc]
>> initWithTrack:track outputSettings:audioReadSettings];
>>
>> Any ideas? Many thanks for reading if you have gotten this far!
>>
>> Simon
>>
>>
>> ------------------------------
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <https://lists.apple.com/mailman/private/coreaudio-api/attachments/20130115/dfffd3a4/attachment.html>
>
> ------------------------------
>
> _______________________________________________
> Coreaudio-api mailing list
> email@hidden
> https://lists.apple.com/mailman/listinfo/coreaudio-api
>
> End of Coreaudio-api Digest, Vol 10, Issue 19
> *********************************************
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: RE: Using AVSampleRateKey in outputSettings for AVAssetReaderTrackOutput
  • Next by Date: Bassless audio input (high pass filter?) - fixed by launching Jamup first! Why?
  • Previous by thread: RE: Using AVSampleRateKey in outputSettings for AVAssetReaderTrackOutput
  • Next by thread: Bassless audio input (high pass filter?) - fixed by launching Jamup first! Why?
  • Index(es):
    • Date
    • Thread