For some of these formats there is the option of using the Fluendo codec package. This is easy to setup and will ensure that your files will play in any application which uses the gstreamer framework, which is used by the majority of GNOME desktop media players. The downside is that it costs nearly 30 euros.
If you don't care about gstreamer support and are happy using mplayer, or as in my case you need playback to work in mplayer, there is an alternative. The solution involves using mplayer in combination with a binary codec pack in order to allow playback. The codec pack is originally packaged by the mplayer team and a list of the dlls and what formats they support can be figured out from the mplayer codec status table
On 32bit Ubuntu the package which contains these codecs is called w32codecs and is 32 bit, i386, only. It will not install on 64 bit, amd64, ubuntu and typically comes from the medibuntu repository. Attempting to install it, with something like the medibuntu repository added to your source list will give you:
On 32bit Ubuntu the package which contains these codecs is called w32codecs and is 32 bit, i386, only. It will not install on 64 bit, amd64, ubuntu and typically comes from the medibuntu repository. Attempting to install it, with something like the medibuntu repository added to your source list will give you:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package w32codecs
While there is a w64codecs package which will be found and installable this package does not contain the majority of codecs.
The w32codecs package depends on mplayer being compiled for 32 bit and if you're running a 64 bit version of Ubuntu, installing the 32 bit version of mplayer isn't something that you can easily do. The easiest way to work around this is to manually compile the 32 bit version of mplayer yourself.
The following is based on the forum posts at http://ubuntuforums.org/showthread.php?t=739011 cleaned up and tested on a clean install of 11.10 Server x64. The instructions will work on other x64 Linux distributions, but you will need to replace the apt-get lines in order to install the dependencies for compiling mplayer for your own distribution. This is a tiny configuration of mplayer, which is suitable to use for transcoding video to a newer format or in my case transcoding WMA lossless to PCM for a SqueezeBox server. It does not contain the vast majority of plugins or native mplayer codecs. Should you require them, then configuring mplayer to compile with the rest of the codecs is left as an exercise to the reader.
I will be installing mplayer into:
/opt/mplayer32
and the codecs into:
/opt/w32codecs
We will be using the latest SVN checkout tarball from the mplayer website at:
http://www.mplayerhq.hu/design7/dload.html
You will need to download both the "source snapshot" and the "Binary Codec Package (Linux x86 20071007)" from further down the page. Replace the URLs in the commands below if the download fails due to updated URLs or newer versions.
wget http://www.mplayerhq.hu/MPlayer/releases/mplayer-export-snapshot.tar.bz2
wget http://www.mplayerhq.hu/MPlayer/releases/codecs/essential-20071007.tar.bz2
tar -xjf mplayer-export-snapshot.tar.bz2
tar -xjf essential-20071007.tar.bz2
sudo mkdir -p /opt/mplayer32
sudo mv essential-20071007 /opt/w32codecs
sudo mv mplayer-export-2011-11-07/ /opt/mplayer32/src
Install the 32 libraries and applications that are needed to build a 32 bit mplayer
sudo apt-get install ia32-libs lib32stdc++6 gcc git yasm libc6-dev-i386 make
Setup gcc to compile to a 32 bit architecture, this presumes that you're using bash, modify if needed for your specific shell:
export CC="gcc -m32"
Then we do the configure:
cd /opt/mplayer32/src
./configure --enable-cross-compile --target=i686-linux --prefix=/opt/mplayer32 --codecsdir=/opt/w32codecs
Note, while the prefix can be a relative path the codecsdir has to be an absolute path. Using a relative path will allow mplayer to compile but it will not be able to find the dll files that it needs from the codecsdir.
The first time you do this you will also be prompted to download the FFmpeg version from the git repository, go ahead and press enter when prompted to do so:
No FFmpeg checkout, press enter to download one with git or CTRL+C to abort
That's it, we're now ready to compile and install:
make
unset CC
If you have a multi-core machine then replacing the make command with:
make -j4
will allow the compilation to use up to 4 threads in order to speed up the build significantly. The unset is important if you plan to compile anything else in this shell session and will make sure that you don't accidentally compile anything else as 32bit.
Now go ahead and install it:
sudo make install
You should now have a 32 bit mplayer and mencoder.
~$ ls -lha /opt/mplayer32/bin
total 23M
drwxr-xr-x 2 root root 4.0K 2011-11-07 14:15 .
drwxr-xr-x 7 root root 4.0K 2011-11-07 14:15 ..
-rwxr-xr-x 1 root root 11M 2011-11-07 14:15 mencoder
-rwxr-xr-x 1 root root 12M 2011-11-07 14:15 mplayer
The final step to making it all nice and easy to use is to create some links:
sudo ln -s /opt/mplayer32/bin/mplayer /usr/bin/mplayer32
sudo ln -s /opt/mplayer32/bin/mencoder /usr/bin/mencoder32
If you have mplayer installed from the packaging system you can still run it using mplayer/mencoder, the 32 bit version we just compiled can be run via mplayer32/mencoder32.
Finally you can now play things such as WMA lossless files
~$ mplayer32 sample.wma -ao null
MPlayer SVN-r34315-snapshot-4.6.1 (C) 2000-2011 MPlayer Team
Playing sample.wma.
ASF file format detected.
[asfheader] Audio stream found, -aid 1
Clip info:
title: The Parachute Ending
author: Birdy Nam Nam
Load subtitles in ./
==========================================================================
Opening audio decoder: [dmo] Win32/DMO decoders
AUDIO: 44100 Hz, 2 ch, s16le, 1152.0 kbit/81.63% (ratio: 144000->176400)
Selected audio codec: [wma9dmo] afm: dmo (Windows Media Audio 9 DMO)
==========================================================================
AO: [null] 44100Hz 2ch s16le (2 bytes per sample)
Video: no video
Starting playback...
A: 4.7 (04.6) of 350.9 (05:50.9) 1.7%
Note that in this case I'm redirecting the audio to a null device as this setup is purely for SqueezeBox transcoding and the machine doesn't have a sound device.
I will be installing mplayer into:
/opt/mplayer32
and the codecs into:
/opt/w32codecs
We will be using the latest SVN checkout tarball from the mplayer website at:
http://www.mplayerhq.hu/design7/dload.html
You will need to download both the "source snapshot" and the "Binary Codec Package (Linux x86 20071007)" from further down the page. Replace the URLs in the commands below if the download fails due to updated URLs or newer versions.
wget http://www.mplayerhq.hu/MPlayer/releases/mplayer-export-snapshot.tar.bz2
wget http://www.mplayerhq.hu/MPlayer/releases/codecs/essential-20071007.tar.bz2
tar -xjf mplayer-export-snapshot.tar.bz2
tar -xjf essential-20071007.tar.bz2
sudo mkdir -p /opt/mplayer32
sudo mv essential-20071007 /opt/w32codecs
sudo mv mplayer-export-2011-11-07/ /opt/mplayer32/src
Install the 32 libraries and applications that are needed to build a 32 bit mplayer
sudo apt-get install ia32-libs lib32stdc++6 gcc git yasm libc6-dev-i386 make
Setup gcc to compile to a 32 bit architecture, this presumes that you're using bash, modify if needed for your specific shell:
export CC="gcc -m32"
Then we do the configure:
cd /opt/mplayer32/src
./configure --enable-cross-compile --target=i686-linux --prefix=/opt/mplayer32 --codecsdir=/opt/w32codecs
Note, while the prefix can be a relative path the codecsdir has to be an absolute path. Using a relative path will allow mplayer to compile but it will not be able to find the dll files that it needs from the codecsdir.
The first time you do this you will also be prompted to download the FFmpeg version from the git repository, go ahead and press enter when prompted to do so:
No FFmpeg checkout, press enter to download one with git or CTRL+C to abort
That's it, we're now ready to compile and install:
make
unset CC
If you have a multi-core machine then replacing the make command with:
make -j4
will allow the compilation to use up to 4 threads in order to speed up the build significantly. The unset is important if you plan to compile anything else in this shell session and will make sure that you don't accidentally compile anything else as 32bit.
Now go ahead and install it:
sudo make install
You should now have a 32 bit mplayer and mencoder.
~$ ls -lha /opt/mplayer32/bin
total 23M
drwxr-xr-x 2 root root 4.0K 2011-11-07 14:15 .
drwxr-xr-x 7 root root 4.0K 2011-11-07 14:15 ..
-rwxr-xr-x 1 root root 11M 2011-11-07 14:15 mencoder
-rwxr-xr-x 1 root root 12M 2011-11-07 14:15 mplayer
The final step to making it all nice and easy to use is to create some links:
sudo ln -s /opt/mplayer32/bin/mplayer /usr/bin/mplayer32
sudo ln -s /opt/mplayer32/bin/mencoder /usr/bin/mencoder32
If you have mplayer installed from the packaging system you can still run it using mplayer/mencoder, the 32 bit version we just compiled can be run via mplayer32/mencoder32.
Finally you can now play things such as WMA lossless files
~$ mplayer32 sample.wma -ao null
MPlayer SVN-r34315-snapshot-4.6.1 (C) 2000-2011 MPlayer Team
Playing sample.wma.
ASF file format detected.
[asfheader] Audio stream found, -aid 1
Clip info:
title: The Parachute Ending
author: Birdy Nam Nam
Load subtitles in ./
==========================================================================
Opening audio decoder: [dmo] Win32/DMO decoders
AUDIO: 44100 Hz, 2 ch, s16le, 1152.0 kbit/81.63% (ratio: 144000->176400)
Selected audio codec: [wma9dmo] afm: dmo (Windows Media Audio 9 DMO)
==========================================================================
AO: [null] 44100Hz 2ch s16le (2 bytes per sample)
Video: no video
Starting playback...
A: 4.7 (04.6) of 350.9 (05:50.9) 1.7%
Note that in this case I'm redirecting the audio to a null device as this setup is purely for SqueezeBox transcoding and the machine doesn't have a sound device.
Great guide! :)
ReplyDeleteI suggest also to install libvx-dev to enable xv video output...
I successfully compiled my version of mplayer32 and I made a deb package! :)
If you want to check it:
https://sourceforge.net/projects/smthplayer/files/extras/mplayer32/
I compiled it with faad2 support, so I've also made a special package cointaining 32-bit version of libfaad2 for amd64...
However, I have a little problem...osd and subtitles don't work...:(
Is there any workaround to solve this???
Just for the record, on the Debian Squeeze I had to do
ReplyDeleteapt-get install gcc-multilib
Afterwards everything builds.
Thanks for the information
Excellent instructions - thanks very much. Now I can play my lossless WMAs from my fedora server on squeezebox.
ReplyDeleteI can confirm these steps also work on 64 bit Fedora with the follow extra step before the configure step:
sudo yum install glibc-devel.i686
on repeating this on Fedora 17, I found I had to do:
Deleteyum install glibc-devel.i686 libgcc.i686
instead of the above line. (Probably because I happened to have libgcc installed before I did this procedure the first time)
Me again. This time I was trying to get this to work on Ubuntu 12.04 but it failed to compile at the "make install" stage with:
Deletelibavcodec/acelp_filters.c: In function 'ff_acelp_filter_init':
libavcodec/acelp_filters.c:151:8: error: 'HAVE_MIPSFPU' undeclared (first use in this function)
I managed to fix this by adding:
%define HAVE_MIPSFPU 0
to config.asm and:
#define HAVE_MIPSFPU 0
to config.h.
I think that if you've gone thru the above steps and got the error I mentioned, then you should make these changes, then do:
make clean
make
make install
or maybe you have to do the config step again - just play around with it.
Oh, also: I don't think I found or needed the glibc-devel.i686 libgcc.i686 packages in ubuntu 12.04
I am not able to compile it on my 64-bit Ubuntu 10.10.
ReplyDeletemake[1]: Leaving directory `/opt/mplayer32/src/ffmpeg'
make: *** [ffmpeg/libavcodec/libavcodec.a] Error 2
Also I was getting a lot of warning statements while compilation, is it normal? The terminal output of compilation command was so long that I cannot post it here. Any idea what could be the reason?
Hi I have a problem. I can run the first 5 commands ok, but when i get to the last one (sudo mv mplayer-export-2011-11-07/ /opt/mplayer32/src) i get an error. I'm a total noob to Ubuntu, can anyone help?
ReplyDeleteAppreciate it.
Spence
fatboyspence@MediaServer:~$ wget http://www.mplayerhq.hu/MPlayer/releases/mplaye r-export-snapshot.tar.bz2
--2012-06-11 10:40:32-- http://www.mplayerhq.hu/MPlayer/releases/mplayer-export -snapshot.tar.bz2
Resolving www.mplayerhq.hu (www.mplayerhq.hu)... 199.125.85.41, 81.91.100.172, 8 2.103.137.100, ...
Connecting to www.mplayerhq.hu (www.mplayerhq.hu)|199.125.85.41|:80... failed: N o route to host.
Connecting to www.mplayerhq.hu (www.mplayerhq.hu)|81.91.100.172|:80... connected .
HTTP request sent, awaiting response... 200 OK
Length: 6246127 (6.0M) [application/x-bzip2]
Saving to: `mplayer-export-snapshot.tar.bz2'
100%[======================================>] 6,246,127 1.88M/s in 3.4s
2012-06-11 10:40:39 (1.74 MB/s) - `mplayer-export-snapshot.tar.bz2' saved [62461 27/6246127]
fatboyspence@MediaServer:~$ wget http://www.mplayerhq.hu/MPlayer/releases/codecs /essential-20071007.tar.bz2
--2012-06-11 10:40:51-- http://www.mplayerhq.hu/MPlayer/releases/codecs/essenti al-20071007.tar.bz2
Resolving www.mplayerhq.hu (www.mplayerhq.hu)... 85.214.85.226, 131.246.123.5, 1 43.248.234.110, ...
Connecting to www.mplayerhq.hu (www.mplayerhq.hu)|85.214.85.226|:80... connected .
HTTP request sent, awaiting response... 200 OK
Length: 10009454 (9.5M) [application/x-bzip2]
Saving to: `essential-20071007.tar.bz2'
100%[======================================>] 10,009,454 1.65M/s in 6.3s
2012-06-11 10:40:57 (1.52 MB/s) - `essential-20071007.tar.bz2' saved [10009454/1 0009454]
fatboyspence@MediaServer:~$ tar -xjf mplayer-export-snapshot.tar.bz2
fatboyspence@MediaServer:~$ tar -xjf essential-20071007.tar.bz2
fatboyspence@MediaServer:~$ sudo mkdir -p /opt/mplayer32
fatboyspence@MediaServer:~$ sudo mv essential-20071007 /opt/w32codecs
fatboyspence@MediaServer:~$ sudo mv mplayer-export-2011-11-07/ /opt/mplayer32/src
mv: cannot stat `mplayer-export-2011-11-07/': No such file or directory
Scratch that last message, i was being a numpty, needed to alter the date on the file.
ReplyDeleteIt all worked like a charm.
Brilliant write up! I just used this on Ubuntu 16.04 to get wmal support for Logitech Media Server 7.9. Thanks for all the effort, it still works perfectly!
ReplyDelete