0

I am recording an audio in android in mp3 format and to do that I am using MPEG_4 as an Output Format while AAC as an AudioEncoder and It does record an audio.

The problem is when I am using that file for further processing in python pydub it could not decode the audio amd gives me error something like this:

CouldntDecodeError: Decoding failed. ffmpeg returned error code: 1

Even though I have ffmpeg installed. I have also tried different audio encoder such as AMR_NB but problem is still the same. It couldnt decode the audio.

Here is what I am doing in pydub:

sound = AudioSegment.from_mp3("test.mp3")
    da = np.fromstring(sound.raw_data, dtype=np.int16)

Does anyone have idea what could be the proper AudioEncoder for recording mp3 audio?

Nik391
  • 517
  • 2
  • 7
  • 24

1 Answers1

0

ffmpeg returning an error means something went wrong while ffmpeg was running (so it's not an issue with finding the ffmpeg executable)

pydub uses creates temporary files and passes the path to those files to ffmpeg, so it's possible that some kind of file system restriction is the reason.

You can enable logging as described in the docs to see the ffmpeg call and try to reproduce the error in a terminal

Jiaaro
  • 74,485
  • 42
  • 169
  • 190
  • Yeah I see the point that there might be some system restrictions I'll try to figure that out but I also feel that there is a problem in encoding an audio to mp3 because when I use any other genuine mp3 audio file it works completely fine – Nik391 Aug 12 '16 at 14:36