I have been looking for a solution on Google but, I haven't found one. I even looked on GitHub no luck there. I want it convert an AAC file to a MP3 file. Can anyone offer any suggestions?
I have been looking for a solution on Google but, I haven't found one. I even looked on GitHub no luck there. I want it convert an AAC file to a MP3 file. Can anyone offer any suggestions?
iTunes will do that easily. In Preferences/General/Import Settings choose the mp3 format that you want, click on the song, and choose "Create New Version" in the File menu.
I'm certainly no expert on audio, but I wonder whether a wrapper round ffmpeg might be of use?
Core audio has an audio converter, there maybe an equivalent in AVFoundation as well, not sure. Both AAC and MP3 are lossy so if you convert from AAC to MP3 you will get artifacts from both compression methods in the file. Also, AAC is a newer better standard that supersedes mp3.
Oh man it'll sound horrible. Why do you need mp3's specifically?
NSString *videoIdentifier = @"EdeVaT-zZt4"; // A 11 characters YouTube video identifier
[[XCDYouTubeClient defaultClient] getVideoWithIdentifier:videoIdentifier completionHandler:^(XCDYouTubeVideo *video, NSError *error) {
if (video)
{
// Do something with the `video` object
NSLog (@"Stream URLS Are: %@",video.streamURLs);
}
else
{
// Handle error
}
}];
Here is an example of a download url for a video with iTag = 140. You will notice if you add the mp4 extension to the file it will not play but, if you convert the file to mp3 it plays perfectly. That is why I want to know how to convert a AAC file to mp3. So far I have had not luck.
That's what you call an XY question. You want to do X and ask how to do Y. You don't want to convert AAC to MP3, you want to extract the audio track from a Quicktime file.
Hmm. The file that is downloaded is not a video file but a audio file. It needs to be converted to play property. Please correct me if I am wrong![]()
You are wrong. You want to extract audio from a video, you don't want to convert it.
Please go to this link: http://www.ytapi.com/?vid=9bZkp7q19f0
Try to download the file, then play it. Now try any converter than can handle AAC to Mp3 and then try to play that file.
Think about it: If you can't play it, and a converter that converts AAC to mp3 creates a playable file, then there _is_ AAC in the file, and all you need is extract it. AVFoundation should have everything you need. And for 128 Kbit, I would _really_ recommend extracting it without converting, because you can really do without any further quality loss.
NSURL *inputAssetURL = [NSURL fileURLWithPath:@"/Users/john/Desktop/Encoding Tests/Input.m4a"];
AVAsset *audioAsset = [AVURLAsset assetWithURL:inputAssetURL];
AVAssetExportSession *session = [AVAssetExportSession exportSessionWithAsset:audioAsset presetName:AVAssetExportPresetAppleM4A];
session.outputURL = [NSURL fileURLWithPath:@"/Users/john/Desktop/Encoding Tests/output.m4a"];
session. outputFileType = AVFileTypeAppleM4A;
[session exportAsynchronouslyWithCompletionHandler:^{
NSLog(@"Done 1");
NSLog(@"%ld",(long)session.status);
switch (session.status) {
case AVAssetWriterStatusCompleted:
NSLog(@"Done");
break;
case AVAssetExportSessionStatusCancelled:
NSLog(@"Cancel");
case AVAssetExportSessionStatusFailed:
NSLog(@"Failed");
break;
break;
case AVAssetExportSessionStatusUnknown:
NSLog(@"Unknown");
break;
case AVAssetExportSessionStatusWaiting:
NSLog(@"Wating");
break;
default:
break;
}
}];
Code:NSURL *inputAssetURL = [NSURL fileURLWithPath:@"/Users/soneejohn/Desktop/Encoding Tests/Input.m4a"]; AVAsset *audioAsset = [AVURLAsset assetWithURL:inputAssetURL]; AVAssetExportSession *session = [AVAssetExportSession exportSessionWithAsset:audioAsset presetName:AVAssetExportPresetAppleM4A]; session.outputURL = [NSURL fileURLWithPath:@"/Users/soneejohn/Desktop/Encoding Tests/output.m4a"]; session. outputFileType = AVFileTypeAppleM4A; [session exportAsynchronouslyWithCompletionHandler:^{ NSLog(@"Done 1"); NSLog(@"%ld",(long)session.status); switch (session.status) { case AVAssetWriterStatusCompleted: NSLog(@"Done"); break; case AVAssetExportSessionStatusCancelled: NSLog(@"Cancel"); case AVAssetExportSessionStatusFailed: NSLog(@"Failed"); break; break; case AVAssetExportSessionStatusUnknown: NSLog(@"Unknown"); break; case AVAssetExportSessionStatusWaiting: NSLog(@"Wating"); break; default: break; } }];
It does not work. Any ideas?
Because when you download the file the extension is m4a, but it won't play until encode or convert it. So I was trying to see if I exported it to the same extension it might work. But It didn't, I am fairly new to programming so please bare with me.What didn't work?
You said you wanted AAC to MP3 but all I see is "Input.m4a" and "output.m4a". How could that possibly achieve what you want?!