Sox + MP3: libsox-fmt-mp3 not working
Asked Answered
I

2

8

My server threw this error

Sox::Error (sox FAIL formats: no handler for file extension `mp3'
)

This person (https://superuser.com/questions/421153/how-to-add-a-mp3-handler-to-sox) had a similar issue. The solution listed there was

sudo apt-get install libsox-fmt-mp3

After running this I still was getting the same error, so I uninstalled sox (sudo apt-get remove sox) and then reinstalled it. At this point I'm confident they're both installed with the newest versions since any attempt to install them yields this

libsox-fmt-mp3 is already the newest version.
sox is already the newest version.

However, I still am receiving the same error.

Any idea what I'm missing?

Edit:

I'm using the ruby-sox gem (https://github.com/TMXCredit/ruby-sox) which says the below should be sufficient.

apt-get install libsox-fmt-all sox libchromaprint-dev

But all those are installed and still no dice.

Edit:

The only way I can figure this to happen is if sox is looking for the lib files in the wrong place. With that in mind these details might be helpful,

sudo find / -name sox
/usr/bin/sox
/usr/lib/x86_64-linux-gnu/sox
/usr/lib/mime/packages/sox
/usr/share/doc/sox
/home/deployer/apps/eko/shared/bundle/ruby/2.1.0/gems/ruby-sox-0.0.1/lib/sox

sudo find / -name libsox-fmt-mp3
/usr/share/doc/libsox-fmt-mp3

When I uninstall sox (apt-get remove sox) then I get this when I search for sox

ubuntu@ip-10-0-0-9:~$ sudo find / -name sox
/usr/lib/x86_64-linux-gnu/sox
/home/deployer/apps/eko/shared/bundle/ruby/2.1.0/gems/ruby-sox-0.0.1/lib/sox

To get rid of this sox and hopefully return to a no sox anywhere except the gem experience, I tried

sudo apt-get remove libsox-dev 

which told me a)libsox-dev wasn't installed and b) I needed to

sudo apt-get autoremove

to remove a host of files related to sox that were no longer needed. At this point, besides the gem, there were no sox files. I then

apt-get install libsox-fmt-all sox libchromaprint-dev

As the gem suggested.

No dice. Same error.

Ilo answered 24/4, 2014 at 19:16 Comment(1)
I'm a bit late to the game, but I'm running into this issue as well. I installed libsox-fmt-mp3 as suggested in the other post, to no avail. My use case is recording audio streamed over the internet. Is that the situation of other people getting this error? If it is, I think the problem may be a lack of a header for the mp3 file. The mp3 file I'm trying to convert won't play in VLC media player either.Tremor
I
2

Ult decided to just use wavs. Months later (aka now) requirements changed and in order to support IE I had to get mp3 support up and running. All of the above issues still applied.

Ended up using lame.

system "lame -b 32 --resample 8 -a #{Rails.root.join("tmp",@filename)} #{Rails.root.join("tmp",@output_file_name)}"
Ilo answered 23/3, 2015 at 23:18 Comment(2)
Reach here for same problem. using ffmpeg doing a lot job should be done by sox.Mcmurry
Same here, couldn't get sox to handle mp3 on heroku, i think i'll just fallback to lameDes
T
1

I ran into this issue as well. For me the problem is that I was receiving an audio stream that I thought was mp3 but which was actually aac. Sox doesn't have a handler for aac, but switching to ffmpeg worked like a charm:

ffmpeg -i input.aac output.wav

Tremor answered 20/8, 2019 at 14:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.