convert method
convert audioInput to wav file
Implementation
Future<File?> convert() async {
final FFmpegSession session = await FFmpegKit.execute(
[
'-y',
'-i',
audioInput.path,
'-ar',
'16000',
'-ac',
'1',
'-c:a',
'pcm_s16le',
audioOutput.path,
].join(' '),
);
final ReturnCode? returnCode = await session.getReturnCode();
if (ReturnCode.isSuccess(returnCode)) {
return audioOutput;
} else if (ReturnCode.isCancel(returnCode)) {
logger.debug('File convertion canceled');
} else {
logger.error(
'File convertion error with returnCode ${returnCode?.getValue()}',
);
}
return null;
}