Sox + MP3: libsox-fmt-mp3 not working - audio

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.

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)}"

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

Related

How to install and run Tacotron2 on Ubuntu WSL?

I am running Ubuntu 20.04 on WSL Windows 10 Pro 2004 (19041.388), and I am very much wanting to run Tacotron2 and try out the functionality. I have installed Tacotron2 from git via command-line, but I'm uncertain whether it built successfully. I am a beginner with Linux and Docker, and the install instructions from above-linked Tacotron2 seems confusing.
So here is where I am at:
Installed Docker, confirmed up and running, all good.
Downloaded Tacotron2 via git cmd-line - success.
Executed this command: sudo docker build -t tacotron-2_image -f docker/Dockerfile docker/ - a lot of stuff happened that seemed successful, but at the end, there was an error:
Package libav-tools is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source However the following packages replace it:
ffmpeg
E: Package 'libav-tools' has no installation candidate The command '/bin/bash -c apt-get install -y libasound-dev portaudio19-dev libportaudio2 libportaudiocpp0 ffmpeg libav-tools wget git vim'
returned a non-zero code: 100
At this point I am stuck. It's true that I'm looking to get unstuck on this error, but comprehensively I'm looking for exact steps to be able to run Tacotron2 and ultimately be able to feed it an mp3 file with someone's voice, and then be able to feed it some text, which it will then "speak" in that voice.
That is my understanding of what Tacotron2 is, but I am keen to know if I am going down the wrong path.
Your issue looks quite similar to https://github.com/Rayhane-mamah/Tacotron-2/issues/475
The issue happens because you have libav-tools installation directives in your Dockerfile which is no longer has installation candidates.
To eliminate the error you need to open docker/Dockerfile in any text editor and remove libav-tools from the line that contains
apt-get install -y libasound-dev portaudio19-dev libportaudio2 libportaudiocpp0 ffmpeg libav-tools wget git vim
to have something like
apt-get install -y libasound-dev portaudio19-dev libportaudio2 libportaudiocpp0 ffmpeg wget git vim
Since package ffmpeg already in this list you don't need to add it again.
You can also remove libav-tools from the Dockerfile using sed command in the WSL shell (might need to add sudo before sed if you have error with permissions):
sed -i docker/Dockerfile -e 's/libav-tools\ //g'
Then your build command should pass.

ffmpeg: error while loading shared libraries: libopenh264.so.5

I am using ffmpeg and getting this error
ffmpeg: error while loading shared libraries: libopenh264.so.5: cannot open shared object file: No such file or directory
I have already checked if the library exists and it does. I added it to /etc/ld.so.conf as mentioned in this previous question but it doesn't work.
Another approach that seemed easier and worked for me on Ubuntu 16.04 and python 3.8 was just calling:
conda update ffmpeg
from this post.
I faced this error when I run ffmpeg 4.2.2 under python 3.8 environment.
The root cause is that libopen264.so from python 3.8 is too new for ffmpeg 4.2.2.
I can find
libopen264.so.6 under the ~/anaconda3/envs/py38/lib/ (py38 is my conda virtual environment), but we only need an older version libopen264.so.5.
To solve the problem, I just make a softlink from my existing anaconda environment (python 3.7) as follows - and it works.
ln -s ~/anaconda3/lib/libopenh264.so ~/anaconda3/envs/py38/lib/libopenh264.so.5
I resolved this by:
Downloading the openh264 binary from GitHub
Copying/renaming the binary to my conda env, e.g. ~/anaconda3/envs/py38/lib/libopenh264.so.5 where py38 is the env name
I had the same issue, to fix it I removed all installs of ffmpeg:
sudo apt-get remove ffmpeg
sudo apt-get purge ffmpeg
After doing this, the output was still the same, which ffmpeg showed me I was using the one from anaconda, so I removed that one (renamed it)
Then I could do a clean install and now it works again:
sudo apt-get install ffmpeg
I copy ~/anaconda3/lib/libopenh264.so, paste to the same folder and rename it to libopenh264.so.5. And it works.
I recently encountered this issue with system-installed ffmpeg, and pip-installed ffmpeg-python within a conda environment.
The work-around for me was uninstalling the system ffmpeg and installing as ffmpeg as a conda package within my conda environment:
# Uninstall ffmpeg system install (assumes Ubuntu)
sudo apt-get remove ffmpeg -y
sudo apt-get purge ffmpeg -y
# Install ffmpeg in conda env
conda install -c conda-forge ffmpeg
I did what Synthesis did, that is
sudo apt-get remove ffmpeg
sudo apt-get purge ffmpeg
However, I removed the Anaconda ffmpeg module
conda remove ffmpeg
The clean install then did the trick:
sudo apt-get install ffmpeg

Updating ffmpeg on Ubuntu 12.04; conflicts with old version from standard repository

I have never used ffmpeg on my Ubuntu Linux 12.04 (Precise Pangolin) box until now. Typing 'ffmpeg' at the command prompt revealed that ffmpeg 0.8.17 (listed as ffmpeg 0.8.17-4:0.8.17-0ubuntu0.12.04.2) was installed. Seeing as I need to convert h.265 to h.264, an update was obviously required.
Following posted instructions, I installed a ream of packages:
$ sudo apt-get install faad libmp4v2-dev libfaac0 libfaac-dev
libxvidcore4 libxvidcore4-dev liba52-0.7.4 liba52-0.7.4-dev libx264-dev
libgsm-tools libogg-dev libtheora-bin libfaad-dev libvorbis-dev
libtheora-dev libdts-dev git-core yasm texi2html checkinstall
followed by
$ sudo apt-get purge ffmpeg
in order to get rid of the old stuff from the original repo.
Downloaded the latest ffmpeg, and a ."/configure; make; sudo make install" later, I should be in business.
Except that typing 'ffmpeg' at the prompt still fired up the old version. A quick look revealed that the old ffmpeg binary was still sitting in /usr/bin with the new one being installed in /usr/local/bin. But ffmpeg is no longer listed as an installed package, and sudo apt-get remove ffmpeg tells me that "Package ffmpeg is not installed, so not removed".
Running /usr/local/bin/ffmpeg directly works, however then fails in an Unknown encoder 'libx264' error. Which is puzzling because the package libx264-120 is installed and /usr/lib/i386-linux-gnu/libx264.so.120 (with the appropriate symlink to /usr/lib/i386-linux-gnu/libx264.so) does exist.
Maybe I've been looking at this for too long, because I'm sure this is a simple issue but I just can't see it.
Can someone please hand me the stupid had and point out why I deserve to wear it?
Tnx!
You should find out which package provides this old binary in /usr/bin by running
dpkg -S /usr/bin/ffmpeg
Then remove that package in turn.
Note that if that file is a symlink, esp. to /etc/alternatives, you should follow the trail of symlinks and then run the above command on the actual binary.

Matlab VideoReader codec error?

When I try to read a video with the VideoReader object it gives the following error
Error using VideoReader/init (line 429)
The file requires the following codec(s) to be installed on your system:
video/x-h264
Has anyone seen this problem before?
By the way, I installed all the Gstream libraries and codes as well as the x-h264 codec.
Add this ppa:
sudo add-apt-repository ppa:mc3man/trusty-media
and then
sudo apt-get update
sudo apt-get install gstreamer0.10-ffmpeg
Had the same problem, doing this fixed it.
If you can play the videos with VLC player, then the following worked for me:
As a workaround you can run MATLAB on the version of libstdc++ installed on your system:
cd to (matlabroot)/sys/os/glnxa64/
Rename libstdc++.so.6 to backuplibstdc++.so.6
Rename libstdc++.so.6.0.10 to backuplibstdc++.so.6.0.10
Restart MATLAB and execute the code again.
The steps are from this link: http://uk.mathworks.com/matlabcentral/answers/94531-why-do-i-receive-an-error-when-creating-a-videoreader-object-on-linux-in-matlab-r2010b-7-11
A simple solution is to install ffmpeg and then use this function:
function v=readVideo(path_file)
system(['rm /tmp/video_tmp.avi']);
system(['ffmpeg -i ' path_file ' -vcodec copy -acodec copy /tmp/video_tmp.avi']);
v = VideoReader('/tmp/video_tmp.avi')
end

bash does not find HTK commands

I am using HTK for quite some time now and it used to work flawlessly. Off late (might have changed some environmental variables in the meantime, cant remember which ones though!), all the HTK commands are "not to be found". Executing HCompV for example gave a
bash: /usr/local/bin/HCompV: No such file or directory
even though HCompV is visible in /usr/local/bin.
Recompiling and installing HTK was futile.
Running HCompV (or any other HTK commands) from the bin folder of the compiled HTK also gave the same error. Any ideas why?
try
hash -d HCompV
or
hash -r
https://unix.stackexchange.com/questions/5609/how-do-i-clear-bashs-cache-of-paths-to-executables
what were the commands to recompile?
make clean
./configure --prefix=/usr/local
make
sudo make install
Solved!!
I had to reinstall the 32 bit libs on my 64 bit ubuntu though I had it installed previously. Any ideas why this helped?
These is what I did:
sudo apt-get install --reinstall ia32-libs
sudo apt-get install --reinstall libc6-i386
This page has more details.
Thank you guys for your reply. You guys rock.

Resources