Android Question [Solved] Correct command for MobileFFmpeg to convert a wav file to mp3

prbmjr

Active Member
Licensed User
Hi everyone!

How the correct command to execute the library FFmpeg to convert a wav file to mp3?

I used this:

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

but I had the follow error:

B4X:
log: Automatic encoder selection failed for output stream #0:0. Default encoder for format mp3 (codec mp3) is probably disabled. Please choose an encoder manually.

any ideas?

br,

Paulo Bueno
 
Last edited:

prbmjr

Active Member
Licensed User
I solved using the follow command:

B4X:
Dim theCmd As String="-i " & File.Combine(shared, "input.wav") & " -write_xing 0 -id3v2_version 0 " & File.Combine(shared, "output.mp3")
Dim id As Long=aMobileFFMPEG.ExecuteAsync(Regex.Split(" ",theCmd))

and I added the correct additional jar file:

B4X:
#AdditionalJar: mobile-ffmpeg-audio-4.4.aar
 
Upvote 0

adriano.freitas

Active Member
I solved using the follow command:

B4X:
Dim theCmd As String="-i " & File.Combine(shared, "input.wav") & " -write_xing 0 -id3v2_version 0 " & File.Combine(shared, "output.mp3")
Dim id As Long=aMobileFFMPEG.ExecuteAsync(Regex.Split(" ",theCmd))

and I added the correct additional jar file:

B4X:
#AdditionalJar: mobile-ffmpeg-audio-4.4.aar

Hi...

I'm still starting programming in this environment (java/android) and there are still some things I really need and I've tried everything without success... Could you help me and other people who have the same difficulty, posting an example and /or step by step how to convert wav files to mp3?


Thank you very much!
 
Upvote 0
Top