C'è un modo per convertire il mio file .WAV registrato nel file .M4A in iOS?Come convertire il file WAV in M4A?
e anche io sono per convertire file .M4A per il wav file.
Ho provato con Audio Queue Services, ma non sono in grado di farlo.
C'è un modo per convertire il mio file .WAV registrato nel file .M4A in iOS?Come convertire il file WAV in M4A?
e anche io sono per convertire file .M4A per il wav file.
Ho provato con Audio Queue Services, ma non sono in grado di farlo.
Questo post: From iPod Library to PCM Samples in Far Fewer Steps Than Were Previously Necessary descrive come caricare un file dalla libreria ipod degli utenti e scriverlo nel file system come un file pcm (wav) lineare.
Credo che il cambiamento che è necessario apportare al codice per caricare un file dal file system invece sarebbe nella NSURL che descrive dove il bene è:
-(IBAction) convertTapped: (id) sender {
// set up an AVAssetReader to read from the iPod Library
NSURL *assetURL = [[NSURL alloc] initFileURLWithPath:@"your_m4a.m4a"];
AVURLAsset *songAsset =
[AVURLAsset URLAssetWithURL:assetURL options:nil];
NSError *assetError = nil;
AVAssetReader *assetReader =
[[AVAssetReader assetReaderWithAsset:songAsset
error:&assetError]
retain];
if (assetError) {
NSLog (@"error: %@", assetError);
return;
}
Se si sta andando nella direzione opposta, sarà necessario modificare la formattazione sul lato di uscita:
NSDictionary *outputSettings =[NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:kAudioFormatLinearPCM], AVFormatIDKey,
[NSNumber numberWithFloat:44100.0], AVSampleRateKey,
[NSNumber numberWithInt:2], AVNumberOfChannelsKey,
[NSData dataWithBytes:&channelLayout length:sizeof(AudioChannelLayout)],
AVChannelLayoutKey,
[NSNumber numberWithInt:16], AVLinearPCMBitDepthKey,
[NSNumber numberWithBool:NO], AVLinearPCMIsNonInterleaved,
[NSNumber numberWithBool:NO],AVLinearPCMIsFloatKey,
[NSNumber numberWithBool:NO], AVLinearPCMIsBigEndianKey,
nil];
non sono sicuro delle impostazioni esatte che andrebbero in qui per m4a, ma questo dovrebbe arrivare più vicino.
L'altra opzione è quella di caricare in ffmpeg lib e fare tutte le conversioni lì, ma sembra diverso da quello che vuoi.
TPAACAudioConverter funziona bene
Che cos'è ChannelLayout qui? –
come per il post collegato: AudioChannelLayout channelLayout; memset (& channelLayout, 0, sizeof (AudioChannelLayout)); channelLayout.mChannelLayoutTag = kAudioChannelLayoutTag_Stereo; – jonbro