• 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: .mov into AudioFilePlayer Unit?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: .mov into AudioFilePlayer Unit?


  • Subject: Re: .mov into AudioFilePlayer Unit?
  • From: Bill Phillips <email@hidden>
  • Date: Tue, 13 Nov 2012 14:52:24 -0500

Chris, you are correct about AVAssetReader. It is a little fiddly, but essentially you set the ASBD for your output data and let her rip. Much, much easier than using AudioQueue or AudioConverter for the same purpose.

When I played with this last year on iOS4, btw, opening a new AVAssetReader for conversion while in the background would fail. Existing AVAssetReaders were fine. The issue may have been fixed since then, though.


On Tue, Nov 13, 2012 at 2:41 PM, Chris Adamson <email@hidden> wrote:
If you don't mind mixing in some AV Foundation with your Core Audio, consider an AVAssetReader. Set it up to give you an AVAssetReaderTrackOutput from the file's audio track, then call that class' copyNextSampleBuffer() to get CMSampleBufferRefs. Core Media then has some convenience functions to get the sample data in a Core Audio format (either as an AudioBufferList, or separate calls to get the packet descriptions and the data buffer).

Actually, you have a bigger problem to deal with: your AAC data can't go into an AUGraph without first being converted to LPCM. I think you can have AVAssetReader do this conversion for you, by setting the outputSettings of the AVAssetReaderTrackOutput to some AUGraph-friendly LPCM format. Assuming that works, you'd be receiving LPCM in the CMSampleBufferRefs, and could then just fetch that data as AudioBufferLists, which should be what you need in your AUGraph (particularly if you're doing this in an AURenderCallback… usual caveats about slow/indeterminate operations in render callbacks, yada yada).

Hope this helps. Heck, I just hope it's somewhat correct. Grain of salt: this is pretty speculative.

--Chris

On Nov 13, 2012, at 2:14 PM, Seth Willits <email@hidden> wrote:


I have some .mov files with nothing but a single AAC track in them that I need to pipe through an AUGraph. I figured out all of the AUGraph stuff (*pats myself on the back*) but I was using AudioFileOpenURL with aif files to get an AudioFileID to use with kAudioUnitSubType_AudioFilePlayer units and now I see that AudioFileOpenURL doesn't open mov files — even being nearly identical to an mp4 file.

At this point one reasonable option I see is to transcode the .movs to .mp4s using passthrough since the files are relatively small so it'd be quick, but is there another way that's little work? I don't want to have to read the samples myself from the file, buffer them, and hand them off in a callback to an AudioUnit etc.


--
Seth Willits




_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)

This email sent to email@hidden


 _______________________________________________
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


 _______________________________________________
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

References: 
 >.mov into AudioFilePlayer Unit? (From: Seth Willits <email@hidden>)
 >Re: .mov into AudioFilePlayer Unit? (From: Chris Adamson <email@hidden>)

  • Prev by Date: Re: .mov into AudioFilePlayer Unit?
  • Next by Date: Re: .mov into AudioFilePlayer Unit?
  • Previous by thread: Re: .mov into AudioFilePlayer Unit?
  • Next by thread: Re: .mov into AudioFilePlayer Unit?
  • Index(es):
    • Date
    • Thread