Skip to content Skip to sidebar Skip to footer

'unsupported Input Sample Rate Set' Error While Converting Mkv To Mp3 With Ffmpeg On Python

I'm getting this error on trying to convert some mkv files to mp3 via python. Nearly all files got converted, but some are facing this issue. https://cdn.discordapp.com/attachment

Solution 1:

You are using the encoder mp3_mf which is the MediaFoundation MP3 encoder. Seems like a picky, troublesome encoder. Even if you add -ar 48000 it may still fail with the error nb_samples (1024) != frame_size (0).

To fix it use a different MP3 encoder. Use the output option -c:a libmp3lame (instead of -c:a mp3_mf if you used that).

ffmpeg -i input.mkv -c:a libmp3lame output.mp3

libmp3lame will automatically choose the appropriate sample rate, so no need to add -ar.

Solution 2:

The problem, as the output alludes (unsupported input sample rate set), is that the input has a sample rate of 96kHz, but mp3 can only support sample rates up to 48kHz.

Put -ar 44100 between the input and output files in the command line and it should work for you. If you need a specific sample rate on the output, just change 44100 for eg 48000, 32000.

See https://ffmpeg.org/ffmpeg.html#Audio-Options for more detail.

FWIW, you should really paste the full, unedited, ffmpeg command line and output in the description when asking a question like this - it's generally a prerequisite to getting any useful help.

Post a Comment for "'unsupported Input Sample Rate Set' Error While Converting Mkv To Mp3 With Ffmpeg On Python"