Python library for converting files to MP3 and setting their quality

前端 未结 6 1941
天涯浪人
天涯浪人 2020-12-14 18:35

I\'m trying to find a Python library that would take an audio file (e.g. .ogg, .wav) and convert it into mp3 for playback on a webpage.

Also, any thoughts on settin

6条回答
  •  春和景丽
    2020-12-14 19:26

    Looks like PyMedia does this:

    http://pymedia.org/

    and some more info here on converting to various formats, whilst setting the bitrate:

    http://pymedia.org/tut/recode_audio.html

    e.g.

    params= {
    'id': acodec.getCodecId('mp3'),
    'bitrate': r.bitrate,
    'sample_rate': r.sample_rate,
    'ext': 'mp3',
    'channels': r.channels }
    enc= acodec.Encoder( params )
    

提交回复
热议问题