I have a feature to listen to audio files, I'm getting audio files in .wav format and takes too long to play audio. When i tried .mp3 file with same audio player its delay decreased.
Is there any way to convert .wav to .mp3 or any other approches?
FFmpegKit.execute('-i $url output.mp3').then((session) async {
final returnCode = await session.getReturnCode();
if (ReturnCode.isSuccess(returnCode)) {
// SUCCESS
} else if (ReturnCode.isCancel(returnCode)) {
// CANCEL
} else {
// ERROR
}
})
ffmpeg is a complete, cross-platform solution to record, convert and stream audio and video.
Here is a great package that ports ffmpeg features to flutter
Below is a usage example of the package that converts a input.wav file to an output.mp3 file:
You can easily convert between different file formats,
here is a link to the official ffmpeg website if you want to learn more