En/wine multimedia

From Studiosg
Jump to: navigation, search

Welcome to Simone Giustetti's wiki pages.


Languages: English - Italiano


Playing Multimedia Files in Slackware Linux with WINE

Linux offers many programs to listen to music, to play video and lately even to play games. When native applications are not enough, it is often possible to run Windows programs thanks to WINE: the "not an emulator" of Windows for Linux and Unix. WINE recently released its second major stable release and currently supports thousands of applications. For a full list please visit the WINE AppDB web site. In spite of good reviews some applications are afflicted by errors, sudden crashes or the inability to play music, sound tracks or even in game movies and cut scenes. More often than not these issues are not strictly WINE ones, but the result of missing optional libraries or plug-ins. The following article will present a list of the multimedia libraries WINE requires and their main function.

WINE and Multimedia Support

Many multimedia oriented programs can run on Linux and can be used to create or reproduce multimedia content. There are however reasons to chose a program developed for another platform:

  • Your habits or the need to share files with colleagues, employers or customers using that software.
  • The native application included in your distribution of choice does not support all of the needed functionality.
  • You may lack the time or will to learn a new tool wasting the efforts you made earlier.
  • You paid a license for the software and don't want to waste your money.

All legitimate reasons that force you to use 2 operating systems or to run the software in WINE. WINE lets you install and run software written for Windows on Linux avoiding you the hassle to learn a new set of applications to perform your daily activities. WINE supports a large and ever growing number of applications, programs, tools and games with a varying level of compatibility. Some software works flawlessly while some other doesn't work at all. Support level is ranked between Garbage, the lower level meaning that the program is too unstable for daily use, to Platinum, for fully supported software. Multimedia software may happen to suffer from serious issues in spite of a high rating. Sudden freezes, crashes, lack of audiovisual content reproduction and more. Following is an example of the error messages that resulted from a WINE crash when running a game developed for the Windows platform:

  fixme:gstreamer:GST_QueryInterface No interface for {37d84f60-42cb-11ce-8135-00aa004bb851}!
  fixme:gstreamer:event_src 0x7b903dd8 (61441) stub
  fixme:gstreamer:event_src 0x7b903e18 (61441) stub
  fixme:gstreamer:unknown_type Could not find a filter for caps: audio/mpeg, mpegversion=(int)1,
     mpegaudioversion=(int)1, layer=(int)3, rate=(int)44100, channels=(int)2, parsed=(boolean)true
  fixme:gstreamer:watch_bus decodebin0: Your GStreamer installation is missing a plug-in.
  fixme:gstreamer:GST_Connect GStreamer could not find any streams
  fixme:gstreamer:watch_bus decodebin0: Your GStreamer installation is missing a plug-in.
  wine: Unhandled page fault on read access to 0x00000000 at address 0x7c3db38f (thread 0047), starting debugger...
  fixme:quartz:MPEGSplitter_QueryInterface No interface for {37d84f60-42cb-11ce-8135-00aa004bb851}!
  fixme:gstreamer:Gstreamer_FindMatch Could not find plugin for audio/mpeg, mpegversion=(int) 1

The issue arises systematically while playing the game an is not a random event. Bug entries for similar issues can be retrieved searching the Wiki pages of WINE and of many Linux distributions. The error messages marked in bold give us a hint about the underlying problem. It is not a WINE issue, but a consequence of missing plug-ins needed to reproduce the audio format. To better explain the last sentence a brief view of WINE internals is due.

WINE & GStreamer

WINE translates calls to Windows libraries into calls to Linux / Unix libraries performing similar functions. Sometimes it is WINE code to mimic Windows functionalities, but more often than not the translation is delegated to system libraries. For multimedia handling and reproduction WINE leans on GStreamer: a library meant to read and manipulate multimedia streams like animations, movies or music. GStreamer provides a set of general use features that can be expanded through specific plug-ins. The architecture uses an abstraction layer if compared to standard multimedia applications in order to facilitate code and existing plug-in reuse. Usually a plug-in works with one application only, but GStreamer lets you overcame this limit presenting a common interface which all code can plug to in a uniform manner. All of GStreamer based applications and plug-ins can be combined and work with one another. A list of working GStreamer plug-ins and documentation for the library can be found in the project web site.

GStreamer adoption presents many benefits for application development and growth. Adding a new audio format for example is as simple as developing a new plug-in derived from the generic interface. Similarly new functionality can be developed as a plug-in and work immediately with preexisting code. Finally GStreamer can run on a wide range of operating systems and its adoption reduces development time and costs when writing applications running on Linux, MacOsX, Unix, Windows, and more.

Each medal has two faces. All of the GStreamer architecture benefits described above are balanced by the cost of finding, installing, and managing plug-ins. To support as many audio and video formats as possible a lot of plug-ins need installing and periodic updates to correct bugs and include new functionality. Plug-ins and their underlying software libraries are developed independently from the main program and releases have an asynchronous schedule. The official Slackware Linux release includes GStreamer among its packages, but only a subset of the available libraries and plug-ins. WINE issues similar to the one described above can be solved installing missing software libraries.

Slackware Included Libraries

Many packages are required to play music and movies in applications and games running on Linux through WINE. Many are included in the standard Slackware package list; we'll later look at where to find and how to install the rest. A list and a brief description of Slackware 14.2 included libraries is available below:

  • aalib-1.4rc5: An ASCII Art library used to draw images with text strings.
  • cdparanoia-III_10.2: A tool to read audio tracks from a CDs.
  • freeglut-2.8.1: Used to create and manage windows containing OpenGL contexts and graphics.
  • GConf-3.2.6: A configuration database used by many GTK+ applications.
  • libcaca-0.99.beta18: An alternative to aalib.
  • libsoup-2.52.2: A library providing a HTTP client and server for GTK+.
  • libtheora-1.1.1: The codec for the free video format Theora.
  • libvisual-0.4.0: An audio visualization library.
  • taglib-1.10: A library for reading and editing meta-data for several audio formats.
  • eudev-3.1.5: A library for dynamic device recognition.
  • wavpack-4.75.1: A lossless compression tool for audio streams.

Many are installed along the operating system. To check if a package is installed you can search for the related text file in the /var/log/packages directory. For example you could check whether the Theora codec is installed or not using command:

  ls -la /var/log/packages/* | grep -i theora
  -rw-r--r-- 1 root root    1578 Jul 23  2016 /var/log/packages/libtheora-1.1.1-x86_64-1

You could install the eventually missing codec with command:

  installpkg /tmp/libtheora-1.1.1-x86_64-1.txz

Missing packages are available on a Slackware installation media, both CD and DVD, or can be downloaded from the distribution web site.

Slackware Missing Libraries

Every Slackware Linux release includes several thousand packages. Nevertheless not all of the existing free software is included into the distribution. Slackware policy always consisted in providing its user base a stable and well tested system rather than the greater number of packages available. Regarding GStreamer, for example, only the base system and a set of well supported plug-ins are packaged:

  • gstreamer-1.6.4-x86_64-1
  • gstreamer0-0.10.36-x86_64-1
  • gst-plugins-base-1.6.4-x86_64-1
  • gst-plugins-base0-0.10.36-x86_64-2
  • gst-plugins-good-1.6.4-x86_64-1
  • gst-plugins-good0-0.10.31-x86_64-2

WINE and other programs may incur in audio and video formats the included plug-ins cannot decode; then you'll have no choice but to install libraries and plug-ins not as well supported as the rest or distributed under a non free license. Packages for such software should be built and installed from the source code. Luckily build scripts for the packages are available in the web site of project SlackBuilds.org, whose goal is "to have the largest collection of SlackBuild scripts available while still ensuring that they are of the highest quality". A quick search for GStreamer and FFmpeg will return a list of packages filling the holes left by Slackware 14.2. Among others the list includes:

  • alsa-plugin-ffmpeg-1.1.1: The FFmpeg plug-ins for ALSA, the Linux audio system.
  • ffmpeg-3.2.4: FFmpeg is a tool to record, convert and stream audio and video.
  • gst0-ffmpeg-0.10.13: The FFmpeg plug-ins for GStreamer.
  • gst-plugins-bad-1.6.2: A set of GStreamer plug-ins not up to par compared to the rest.
  • gst-plugins-ugly-1.6.2: A set of good quality GStreamer plug-ins whose license could pose problem with their distribution.

Below you'll find the procedure to build and install a tgz package, the format adopted by Slackware, for gst-plugins-bad. The procedure is generic and can be used for all other packages by changing the name of the script and source tarballs.

  • Download the tarball containing the build script for the package.
You can download the compressed archive with your browser of choice or with command wget.
  cd /tmp
  wget https://www.slackbuilds.org/slackbuilds/14.2/multimedia/gst-plugins-bad.tar.gz
  • Extract the archive with command tar.
  tar -zxf gst-plugins-bad.tar.gz
  • Move in the newly created directory.
  cd gst-plugins-bad
  ls -la
  total 24
  drwxr-xr-x  2 1016 users 4096 Jan  9 22:07 .
  drwxrwxrwt 42 root root  4096 Apr 26 19:25 ..
  -rw-r--r--  1 1016 users  592 Jan  9 22:07 README
  -rwxr-xr-x  1 1016 users 2975 Jan  9 22:07 gst-plugins-bad.SlackBuild
  -rw-r--r--  1 1016 users  329 Jul  2  2016 gst-plugins-bad.info
  -rw-r--r--  1 1016 users 1004 Jul  2  2016 slack-desc
  • Download the source code for the package using the link available in the SlackBuilds.org web page.
  wget http://gstreamer.freedesktop.org/src/gst-plugins-bad/gst-plugins-bad-1.6.2.tar.xz
  • Run the SlackBuild build script.
  sh ./gst-plugins-bad.SlackBuild

The script will extract the source code from the compressed archive then it will compile the code and execute every other step needed to produce a working package in directory /tmp: gst-plugins-bad-1.6.2-x86_64-2_SBo.tgz for a 64 bit processor.

  • Install the newly created package with command installpkg.
  installpkg ./gst-plugins-bad-1.6.2-x86_64-2_SBo.tgz

Both the last 2 commands should be run by user root.

  • Remove temporary files produced while building the package.
  cd /tmp
  rm -r /tmp/SBo

As stated above if you wish to install more than one package, the procedure should be repeated many times.

Multi-Library System

64 bit processors compatible with the Intel instruction set were marketed in 2003 and supported by many Linux distributions later that same year. The first 64 bit compatible Windows operating system was marketed in the first half of 2005. Sadly, although more that 10 years have passed, many Windows developed applications only offer a 32 bit version. Code compiled for a 32 bit architecture can be run on a 64 bit processor only by installing some compatibility libraries. To ensure that WINE runs any program on 64 bit Linux you must install all 64 bit dependencies, libraries, and compat32 packages for 32 bit compatibility.

A short guide to convert a pure 64 bit Linux system into a multi-lib one was published in this very same web site. The most recent guide and packages are available in Alien Bob web site.

Installing the multi-lib libraries is a rather easy and straightforward activity, but 32 bit packages require somewhat of a greater effort. The included massconvert32.sh script converts but a subset of the packages included in the official Slackware release and not one among the external dependencies. Regarding GStreamer, massconvert32.sh works the main program and the base plug-ins, that are sadly not enough to decode all of the existing multimedia formats Linux can manage and recent WINE releases use. Missing packages should be converted and installed following the instructions below:

  • Copy packages from a 32 bit Slackware installation media or download them into a directory of your computer.
  • Create a directory to store converted packages:
  mkdir /tmp/compat32
  • Convert packages using the previously mentioned convertpkg-compat32 command:
  convertpkg-compat32 -i ./aalib-1.4rc5-i486-5.txz -d /tmp/compat32/
  convertpkg-compat32 -i ./cdparanoia-III_10.2-i486-1.txz -d /tmp/compat32/
  convertpkg-compat32 -i ./libcaca-0.99.beta18-i486-2.txz -d /tmp/compat32/
  convertpkg-compat32 -i ./libsoup-2.52.2-i586-1.txz -d /tmp/compat32/
  convertpkg-compat32 -i ./libtheora-1.1.1-i486-1.txz -d /tmp/compat32/
  convertpkg-compat32 -i ./libvisual-0.4.0-i486-3.txz -d /tmp/compat32/
  convertpkg-compat32 -i ./libvisual-plugins-0.4.0-i486-2.txz -d /tmp/compat32/
  convertpkg-compat32 -i ./libvpx-1.5.0-i586-1.txz -d /tmp/compat32/
  convertpkg-compat32 -i ./taglib-1.10-i586-1.txz -d /tmp/compat32/
  convertpkg-compat32 -i ./taglib-extras-1.0.1-i486-1.txz -d /tmp/compat32/
  convertpkg-compat32 -i ./wavpack-4.75.2-i586-1.txz -d /tmp/compat32/
  • Install the newly converted packages using command installpkg:
  installpkg  /tmp/compat32/*.t?z

When all is done both the 32 bit packages and the ones in directory /tmp/compat32/ can be removed from the system.

Last FFmpeg and the bad and ugly GStreamer plug-in sets. There is no official package for them nor for the compat32 32 bit compatibility ones. The first step consists of building working packages to be later converted as previously done for the standard plug-ins. We are in need of two conditions to build packages:

  • SlackBuild build scripts.
  • A 32 bit environment.

The first prerequisite presents no problem: you'll be able to use the very same scripts previously downloaded from the SlackBuilds.org web site. The build procedure does not change from 64 to 32 bit. You could build packages on a dedicated disk partition or a virtual machine with 32 bit Slackware 14.2 installed. The latter scenario probably offers more benefits. Installing a VirtualBox virtual machine is probably easier and more convenient if compared to installing Slackware 14.2 in a dedicated partition or disk. Whatever the case you are strongly suggested to assign a minimum 12 Gb disk space for the environment. Building software is a resource consuming activity and a lot of storage goes wasted for source code and temporary files.

Once built, 32 bit packages can be converted in compatibility ones with command convertpkg-compat32:

  convertpkg-compat32 -i alsa-plugin-ffmpeg-1.1.1-i586-1_SBo.tgz -d /tmp/compat32/
  convertpkg-compat32 -i ffmpeg-3.2.4-i486-1_SBo.tgz -d /tmp/compat32/
  convertpkg-compat32 -i gst-plugins-bad-1.6.2-i486-2_SBo.tgz -d /tmp/compat32/
  convertpkg-compat32 -i gst-plugins-ugly-1.6.2-i486-1_SBo.tgz -d /tmp/compat32/
  convertpkg-compat32 -i gst0-ffmpeg-0.10.13-i486-1_SBo.tgz -d /tmp/compat32/

then installed with command installpkg:

  installpkg  /tmp/compat32/*.t?z

One again when the installation is concluded both 32 bit packages and the ones in directory /tmp/compat32/ can be removed from the system.


Conclusions

WINE is a great solution to run on Linux / Unix multimedia applications written for the Windows operating system, but all required dependencies should be installed as well. Any missing dependency can raise serious issues and eventually lead to apparently inexplicable WINE crashes. This article lists some dependencies that are not included in standard Slackware Linux and provides a brief guide about the procedure to install them on 32-bit, 64-bit, or multi-library Linux systems.


For any feedback, questions, errors and such, please e-mail me at studiosg [at] giustetti [dot] net


External links





Languages: English - Italiano