-
Notifications
You must be signed in to change notification settings - Fork 7
SoX MP4 support
SoX lists MP4 support on its features page:
MP4, AAC, AC3, WAVPACK, AMR-NB files (with optional ffmpeg library)
So install ffmpeg:
sudo apt install ffmpegTo check the formats sox and ffmpeg will read:
sox --help-format all
ffmpeg -formats
ffmpeg -codecs-
ffmpeg -formatsgives a line:E mp4 MP4 (MPEG-4 Part 14)in which the
Eindicates "Muxing supported"
To test out the support:
sox output.mp4 output.wav⇣
sox FAIL formats: no handler for file extension `mp4'
or even simply use the play utility SoX provides:
play output.mp4⇣
play WARN alsa: can't encode 0-bit Unknown or not applicable
play FAIL formats: no handler for file extension `mp4'
Since sox doesn't work with ffmpeg to read MP4 'out of the box' (i.e. from pre-built binary)
we will follow this suggestion:
Yes..sox has support for mp4, m4p, & m4a. They're marked as optional in the pdf manual. Perhaps one has to compile sox from the source files e.g. the sox(version number).tar.gz source package...unpack it using an archive manager, then do something like make, make install, etc... while including the additional option for the mp4 types of files. Checkout the README file in the package to make sure.
First remove the apt-installed binary and any other libraries it pulled in:
sudo apt purge --autoremove sox⇣
The following packages will be REMOVED
libsox-fmt-alsa* libsox-fmt-base* libsox3* sox*
The source code can be downloaded from the repo as
git clone https://git.code.sf.net/p/sox/code sox-codein which the README.osx (by which they mean Unix, i.e. OSX and Linux)
In an appendix, the README says:
SoX contains support for reading and writing MP3 files but does not ship with the dylib's that perform decoding and encoding of MP3 data because of patent restrictions. For further details, refer to:
https://en.wikipedia.org/wiki/MP3#Licensing_and_patent_issues
MP3 support can be enabled by placing Lame encoding library and/or MAD decoding library into a standard library search location such as
/usr/libor setLTDL_LIBRARY_PATHto location.These can be compiled yourself, they may turn up on searches of the internet or may be included with other MP3 applications already installed on your system. Try searching for
libmp3lame.dylibandlibmad.dylib.Obtain the latest Lame and MAD source code from approprate locations.
Lame MP3 encoder MAD MP3 decoder
If your system is setup to compile software, then the following commands can be used. Note: since SoX is distributed as a 32-bit i386 binary, the library must match that format as well:
cd lame-398-2 ./configure CFLAGS="-arch i386 -m32" LDFALGS="-arch i386" make sudo make install cd libmad-0.15.1b ./configure CFLAGS="-arch i386 -m32" LDFALGS="-arch i386" make sudo make install