kkroening / ffmpeg-python

Python bindings for FFmpeg - with complex filtering support
Apache License 2.0
10.08k stars 893 forks source link

ffmpeg python - Unable to change the bitrate of Mp3 audiofile #383

Open KishanGosh opened 4 years ago

KishanGosh commented 4 years ago

Hi all,

I used this python code for converting a wav file to mp3 file, All parameters are changed as per the given input but if i try changing bit rate to 128kbps , the resultant file shows is just 64kbps. I have tried changing all formats of input file(wav, aac,mp3) but not able to change the bitrate more than 64kbps.

stream = ffmpeg.input('D:/Projects/Wav file/Demo/109-Sin_1500_48000Hz-PCM_24_Ch-6.wav') stream = ffmpeg.output(stream, 'D:/Projects/Wav file/Demo/testm6.mp3',acodec ='libmp3lame',audio_bitrate='128k', ar=44100,ac=2) stream = ffmpeg.overwrite_output(stream) ffmpeg.run_async(stream)

Even tried "ab=128k or ab=128000" instead of audio_bitrate

Resultant file : bitrate is 64kbps Given input : 128kbps

What might be th factor i am missing here ? Why ffmpeg is not changing the bitrate more than 64kbps ?

DeppWang commented 3 years ago

I use the **.mp3 file, can change the bitrate to 128K, try to use mp3 file, not the wav file.