未能使用FFmpegWrapper将音频文件从M4A转换为MP3格式

时间:2016-10-07 06:30:34

标签: ios objective-c ffmpeg

我试图在iOS项目中使用FUNCTION XMLTEST (P_XML VARCHAR2) RETURN VARCHAR2 AS V_FLAG VARCHAR2(4000); BEGIN WITH test_data AS (SELECT xmltype(P_XML) data FROM dual ) SELECT extractValue(data,'/boolean','xmlns="http://SOAPwebservice.com/WebServices/Methods"') FROM test_data; return V_FLAG; 将M4A音频文件转换为MP3格式,语言:目标C.为了方便起见,我尝试使用ffmpeg < / p>

我使用通过CocoaPods安装的ffmpeg ver 2.8.3和FFmpegWrapper 1.0。在FFmpegWrapper,它显示我使用的是最新版本。

这是我的代码:

pod outdated

结果转换失败时显示以下日志:

- (void) convertMP4ToMP3
{
    NSString *inputFormat = @"m4a";
    NSString *outputFormat = @"mp3";

    NSString *inputFileName = @"audio";
    NSString *outputFileName = @"outputAudio";

    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];
    NSString *inputFilePath = [[NSBundle mainBundle] pathForResource:inputFileName ofType:inputFormat];
    NSString *outputFilePath = [documentsDirectory stringByAppendingPathComponent:[outputFileName stringByAppendingPathExtension:outputFormat]];

    if ([[NSFileManager defaultManager] fileExistsAtPath:outputFilePath])
    {
        [[NSFileManager defaultManager] removeItemAtPath:outputFilePath error:nil];
    }

    FFmpegWrapper *wrapper = [[FFmpegWrapper alloc] init];
    NSDictionary *options = @{kFFmpegInputFormatKey : inputFormat, kFFmpegOutputFormatKey : outputFormat};
    [wrapper convertInputPath:inputFilePath outputPath:outputFilePath options:options progressBlock:^(NSUInteger bytesRead, uint64_t totalBytesRead, uint64_t totalBytesExpectedToRead) {
    } completionBlock:^(BOOL success, NSError *error) {

        success ? NSLog(@"Success!") : NSLog(@"Error : %@",error.localizedDescription);
    }];
}

任何帮助都将不胜感激。

0 个答案:

没有答案