[SOLVED] To convert audio file from .wav to .mp3 using ffmpeg flutter

Issue

This Content is from Stack Overflow. Question asked by Akhil

I needed to convert an audio file from .wav to .mp3, i have used this package for converting.But its returning with code 1.

 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

                                                        }
                                                      })

conversion no

Solution

convertingwav to mp3 linux ffmpeg

ffmpeg -i input.wav -vn -ar 44100 -ac 2 -b:a 192k output.mp3

ffmpeg change audio codec from m4a to mp3

ffmpeg -i “$f” -codec:v copy -codec:a libmp3lame -q:a 2 newfiles/”${f%.m4a}.mp3″;

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5.CC BY-SA 3.0.CC BY-SA 4.0.

people found this article helpful. What about you?