I want to extract audio from video with this method:
Future<Audio> extractAudio(Video video, String formatAudioByUser) async {
final pathAudio = video.pathIn;
FFmpegKit.execute(
'-i ${video.pathIn} -q:a 0 -map a audio_${video.title}.mp3')
.then((session) async {
final returnCode = await session.getReturnCode();
if (ReturnCode.isSuccess(returnCode)) {
Fluttertoast.showToast(msg: 'Extraccion exitosa');
} else if (ReturnCode.isCancel(returnCode)) {
Fluttertoast.showToast(msg: 'Extraccion cancelada');
} else {
final error = await session.getFailStackTrace();
Fluttertoast.showToast(msg: 'Fallo al extraer audio: $error');
}
});
//creates object
final audio = Audio(
id: 'audio_${video.id}',
title: 'audio_${video.title}',
duration: video.duration,
pathIn: video.pathIn,
pathOut:pathAudio,
format: formatAudioByUser,
);
return audio;
}
which i use in my datasource_impl.
But when choosing the media (video) and running the method, it doesn't work from the ffmpegkit script, and it shows this error: "Fallo al extraer audio: null"
I've reviewed the debugging mode, and created brakpoints, but all the video data looks good.