Is there a more lightweight solution to read/write MP3 with Linux+Python?
up vote
0
down vote
favorite
This works very well to export a WAV to MP3:
from pydub import AudioSegment
song = AudioSegment.from_wav("test.wav")
song.export("test.mp3", format="mp3", bitrate="256k")
but it requires to install ffmpeg which takes 338 MB with apt-get install ffmpeg:

I'm working on a small container, thus I'd like to avoid using 338 MB for this task.
Is there a more lightweight solution to read/write MP3 with Python+Linux?
apt python audio mp3
|
show 1 more comment
up vote
0
down vote
favorite
This works very well to export a WAV to MP3:
from pydub import AudioSegment
song = AudioSegment.from_wav("test.wav")
song.export("test.mp3", format="mp3", bitrate="256k")
but it requires to install ffmpeg which takes 338 MB with apt-get install ffmpeg:

I'm working on a small container, thus I'd like to avoid using 338 MB for this task.
Is there a more lightweight solution to read/write MP3 with Python+Linux?
apt python audio mp3
3
Please avoid screenshots, that's just fugly.
– tink
Nov 29 at 17:19
Does pythonstudio.us/learning/the-lame-project.html help? :)
– tink
Nov 29 at 17:22
@tink It's as ugly as having to install 338 MB to decode a MP3 ;)
– Basj
Nov 29 at 17:27
@tink Thank you for your answer. This solution seems to involve C compiling, etc. so it will require to install dev tools too (build-essential) and it will be big too. I'm looking for a binary that could decode/encode MP3 from Python in a few megabytes maximum.
– Basj
Nov 29 at 17:29
1
You don't need to include the build-environment in your container ... ?
– tink
Nov 29 at 17:48
|
show 1 more comment
up vote
0
down vote
favorite
up vote
0
down vote
favorite
This works very well to export a WAV to MP3:
from pydub import AudioSegment
song = AudioSegment.from_wav("test.wav")
song.export("test.mp3", format="mp3", bitrate="256k")
but it requires to install ffmpeg which takes 338 MB with apt-get install ffmpeg:

I'm working on a small container, thus I'd like to avoid using 338 MB for this task.
Is there a more lightweight solution to read/write MP3 with Python+Linux?
apt python audio mp3
This works very well to export a WAV to MP3:
from pydub import AudioSegment
song = AudioSegment.from_wav("test.wav")
song.export("test.mp3", format="mp3", bitrate="256k")
but it requires to install ffmpeg which takes 338 MB with apt-get install ffmpeg:

I'm working on a small container, thus I'd like to avoid using 338 MB for this task.
Is there a more lightweight solution to read/write MP3 with Python+Linux?
apt python audio mp3
apt python audio mp3
asked Nov 29 at 17:17
Basj
90821135
90821135
3
Please avoid screenshots, that's just fugly.
– tink
Nov 29 at 17:19
Does pythonstudio.us/learning/the-lame-project.html help? :)
– tink
Nov 29 at 17:22
@tink It's as ugly as having to install 338 MB to decode a MP3 ;)
– Basj
Nov 29 at 17:27
@tink Thank you for your answer. This solution seems to involve C compiling, etc. so it will require to install dev tools too (build-essential) and it will be big too. I'm looking for a binary that could decode/encode MP3 from Python in a few megabytes maximum.
– Basj
Nov 29 at 17:29
1
You don't need to include the build-environment in your container ... ?
– tink
Nov 29 at 17:48
|
show 1 more comment
3
Please avoid screenshots, that's just fugly.
– tink
Nov 29 at 17:19
Does pythonstudio.us/learning/the-lame-project.html help? :)
– tink
Nov 29 at 17:22
@tink It's as ugly as having to install 338 MB to decode a MP3 ;)
– Basj
Nov 29 at 17:27
@tink Thank you for your answer. This solution seems to involve C compiling, etc. so it will require to install dev tools too (build-essential) and it will be big too. I'm looking for a binary that could decode/encode MP3 from Python in a few megabytes maximum.
– Basj
Nov 29 at 17:29
1
You don't need to include the build-environment in your container ... ?
– tink
Nov 29 at 17:48
3
3
Please avoid screenshots, that's just fugly.
– tink
Nov 29 at 17:19
Please avoid screenshots, that's just fugly.
– tink
Nov 29 at 17:19
Does pythonstudio.us/learning/the-lame-project.html help? :)
– tink
Nov 29 at 17:22
Does pythonstudio.us/learning/the-lame-project.html help? :)
– tink
Nov 29 at 17:22
@tink It's as ugly as having to install 338 MB to decode a MP3 ;)
– Basj
Nov 29 at 17:27
@tink It's as ugly as having to install 338 MB to decode a MP3 ;)
– Basj
Nov 29 at 17:27
@tink Thank you for your answer. This solution seems to involve C compiling, etc. so it will require to install dev tools too (
build-essential) and it will be big too. I'm looking for a binary that could decode/encode MP3 from Python in a few megabytes maximum.– Basj
Nov 29 at 17:29
@tink Thank you for your answer. This solution seems to involve C compiling, etc. so it will require to install dev tools too (
build-essential) and it will be big too. I'm looking for a binary that could decode/encode MP3 from Python in a few megabytes maximum.– Basj
Nov 29 at 17:29
1
1
You don't need to include the build-environment in your container ... ?
– tink
Nov 29 at 17:48
You don't need to include the build-environment in your container ... ?
– tink
Nov 29 at 17:48
|
show 1 more comment
1 Answer
1
active
oldest
votes
up vote
0
down vote
Not 100% sure it will work, but I'll try it:
Go on https://www.ffmpeg.org/download.html, select "Linux Static Builds", this redirects to https://johnvansickle.com/ffmpeg/. Then select https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz, do
tar ffmpeg-release-amd64-static.tar.xz
Then:
./ffmpeg
seems to work.
It might be possible to keep only one of the 3 (or am I wrong?)
-rwxr-xr-x 1 1000 1000 63M Nov 12 02:45 ffmpeg
-rwxr-xr-x 1 1000 1000 64M Nov 12 03:05 ffmpeg-10bit
-rwxr-xr-x 1 1000 1000 63M Nov 12 02:45 ffprobe
so I think we can reduce the required size to 63M.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Not 100% sure it will work, but I'll try it:
Go on https://www.ffmpeg.org/download.html, select "Linux Static Builds", this redirects to https://johnvansickle.com/ffmpeg/. Then select https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz, do
tar ffmpeg-release-amd64-static.tar.xz
Then:
./ffmpeg
seems to work.
It might be possible to keep only one of the 3 (or am I wrong?)
-rwxr-xr-x 1 1000 1000 63M Nov 12 02:45 ffmpeg
-rwxr-xr-x 1 1000 1000 64M Nov 12 03:05 ffmpeg-10bit
-rwxr-xr-x 1 1000 1000 63M Nov 12 02:45 ffprobe
so I think we can reduce the required size to 63M.
add a comment |
up vote
0
down vote
Not 100% sure it will work, but I'll try it:
Go on https://www.ffmpeg.org/download.html, select "Linux Static Builds", this redirects to https://johnvansickle.com/ffmpeg/. Then select https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz, do
tar ffmpeg-release-amd64-static.tar.xz
Then:
./ffmpeg
seems to work.
It might be possible to keep only one of the 3 (or am I wrong?)
-rwxr-xr-x 1 1000 1000 63M Nov 12 02:45 ffmpeg
-rwxr-xr-x 1 1000 1000 64M Nov 12 03:05 ffmpeg-10bit
-rwxr-xr-x 1 1000 1000 63M Nov 12 02:45 ffprobe
so I think we can reduce the required size to 63M.
add a comment |
up vote
0
down vote
up vote
0
down vote
Not 100% sure it will work, but I'll try it:
Go on https://www.ffmpeg.org/download.html, select "Linux Static Builds", this redirects to https://johnvansickle.com/ffmpeg/. Then select https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz, do
tar ffmpeg-release-amd64-static.tar.xz
Then:
./ffmpeg
seems to work.
It might be possible to keep only one of the 3 (or am I wrong?)
-rwxr-xr-x 1 1000 1000 63M Nov 12 02:45 ffmpeg
-rwxr-xr-x 1 1000 1000 64M Nov 12 03:05 ffmpeg-10bit
-rwxr-xr-x 1 1000 1000 63M Nov 12 02:45 ffprobe
so I think we can reduce the required size to 63M.
Not 100% sure it will work, but I'll try it:
Go on https://www.ffmpeg.org/download.html, select "Linux Static Builds", this redirects to https://johnvansickle.com/ffmpeg/. Then select https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz, do
tar ffmpeg-release-amd64-static.tar.xz
Then:
./ffmpeg
seems to work.
It might be possible to keep only one of the 3 (or am I wrong?)
-rwxr-xr-x 1 1000 1000 63M Nov 12 02:45 ffmpeg
-rwxr-xr-x 1 1000 1000 64M Nov 12 03:05 ffmpeg-10bit
-rwxr-xr-x 1 1000 1000 63M Nov 12 02:45 ffprobe
so I think we can reduce the required size to 63M.
answered Nov 30 at 17:45
Basj
90821135
90821135
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f484978%2fis-there-a-more-lightweight-solution-to-read-write-mp3-with-linuxpython%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
3
Please avoid screenshots, that's just fugly.
– tink
Nov 29 at 17:19
Does pythonstudio.us/learning/the-lame-project.html help? :)
– tink
Nov 29 at 17:22
@tink It's as ugly as having to install 338 MB to decode a MP3 ;)
– Basj
Nov 29 at 17:27
@tink Thank you for your answer. This solution seems to involve C compiling, etc. so it will require to install dev tools too (
build-essential) and it will be big too. I'm looking for a binary that could decode/encode MP3 from Python in a few megabytes maximum.– Basj
Nov 29 at 17:29
1
You don't need to include the build-environment in your container ... ?
– tink
Nov 29 at 17:48