pythonpython-3.xffmpeglightweight-processes

Convert webm to mp3 using python?


Yes I know that this has been asked many many times, but the libraries on every single answer just ends up needing ffmepg.

The problem with that is that the file size increases dramatically when I include ffmpeg to my project, and I just don't want that.

I want to keep my project as lightweight as possible without needing to add 200 meabytes of data just for video to audio conversion which is just a very small part of the project.

So is there any way to


Solution

  • Compile your own ffmpeg using this configuration to decode Vorbis/Opus audio in WebM and encode MP3 via libmp3lame:

    ./configure --disable-everything --disable-network --disable-autodetect --enable-small --enable-protocol=file,pipe --enable-demuxer=matroska --enable-muxer=mp3 --enable-decoder=vorbis,opus --enable-encoder=libmp3lame --enable-libmp3lame --enable-filter=aresample
    

    Resulting size of ffmpeg is under 2 MB.