ffmpegmp3midibitratefluidsynth

How to change the bit rate of audio while converting from midi file to mp3 using ffmpeg/fluidsynth


I am trying to convert midi file to mp3 using fluidsynth and ffmpeg on Windows 10 OS.

fluidsynth -a alsa -T raw -F - "FluidR3Mono_GM.sf3" simple.mid |  ffmpeg -ab 192k -f s32le -i  simple.mp3

The audio bit rate specification : -ab 192k or -b:a 192k are creating an error:

You are applying an input option to an output file or viceversa.

Is there an option to specify bit rate in the above command.

Taken from Convert midi to mp3


Solution

  • Option placement matters with ffmpeg. You're attempting to apply an output option to the input.

    ffmpeg [input options] input [output options] output
    

    Corrected command:

    fluidsynth -T raw -F - sound_font_file.sf3 input.mid | ffmpeg -y -f s32le -i - -b:a 192k output.mp3
    

    Fore more info about MP3 encoding with ffmpeg see FFmpeg Wiki: MP3.