Compiler GStreamer depuis les sources sous GNU/Linux

Edit: j’ai ajouté un script SHELL “qui fait tout pour vous” en fin de billet…
Voici une petite procédure pour compiler la dernière version du framework multimédia GStreamer tout en préservant la version installée depuis les dépôts officiels. La procédure a été validé sur une GNU/Linux Ubuntu 9.04 mais doit facilement être adaptable à d’autres distribution (pour une procèdure équivalente sous Mac OS X, vous pouvez lire ce billet).
GStreamer étant un framework, il se base sur de nombreuses librairies externes. Pour nous simplifier la tache, nous allons utiliser les dépôts pour l’installation de ces librairies:
sudo aptitude build-dep gstreamer0.10-ffmpeg gstreamer0.10-plugins-bad gstreamer0.10-plugins-bad-multiverse gstreamer0.10-plugins-base gstreamer0.10-plugins-good gstreamer0.10-plugins-ugly gstreamer0.10-plugins-ugly-multiverse bison flex git
Ensuite on récupère les dernières versions disponibles de GStreamer et de ses plugins:
mkdir ~/src
cd ~/src
wget http://gstreamer.freedesktop.org/src/gstreamer/gstreamer-0.10.25.tar.gz
wget http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.25.tar.gz
wget http://gstreamer.freedesktop.org/src/gst-plugins-bad/gst-plugins-bad-0.10.17.tar.gz
wget http://gstreamer.freedesktop.org/src/gst-plugins-good/gst-plugins-good-0.10.17.tar.gz
wget http://gstreamer.freedesktop.org/src/gst-plugins-ugly/gst-plugins-ugly-0.10.13.tar.gz
wget http://gstreamer.freedesktop.org/src/gst-ffmpeg/gst-ffmpeg-0.10.8.tar.gz
On commence par la compilation de GStreamer (core). L’installation se fera dans le répertoire /opt/gstreamer/gstreamer-0.10.24:
tar zxvf gstreamer-0.10.25.tar.gz
cd gstreamer-0.10.25
./configure –prefix=/opt/gstreamer/gstreamer-0.10.25
make
sudo make install
cd ..
… puis les plugins “base”:
tar zxvf gst-plugins-base-0.10.25.tar.gz
cd gst-plugins-base-0.10.25
PKG_CONFIG_PATH=/opt/gstreamer/gstreamer-0.10.25/lib/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig ./configure –prefix=/opt/gstreamer/gstreamer-0.10.25
make
sudo make install
cd ..
… puis les plugins “good”:
tar zxvf gst-plugins-good-0.10.17.tar.gz
cd gst-plugins-good-0.10.17
PKG_CONFIG_PATH=/opt/gstreamer/gstreamer-0.10.25/lib/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig ./configure –prefix=/opt/gstreamer/gstreamer-0.10.25
make
sudo make install
cd ..
… puis les plugins “bad”:
tar zxvf gst-plugins-bad-0.10.17.tar.gz
cd gst-plugins-bad-0.10.17
PKG_CONFIG_PATH=/opt/gstreamer/gstreamer-0.10.25/lib/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig ./configure –prefix=/opt/gstreamer/gstreamer-0.10.25
make
sudo make install
cd ..
… les plugins “ugly”:
tar zxvf gst-plugins-ugly-0.10.13.tar.gz
cd gst-plugins-ugly-0.10.13
PKG_CONFIG_PATH=/opt/gstreamer/gstreamer-0.10.25/lib/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig ./configure –prefix=/opt/gstreamer/gstreamer-0.10.25
make
sudo make install
cd ..
… et enfin les plugins FFMPEG (streaming):
tar zxvf gst-ffmpeg-0.10.8.tar.gz
cd gst-ffmpeg-0.10.8
PKG_CONFIG_PATH=/opt/gstreamer/gstreamer-0.10.25/lib/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig ./configure –prefix=/opt/gstreamer/gstreamer-0.10.25
make
sudo make install
cd ..
Puis on créé un lien symbolique entre le répertoire /opt/gstreamer/current et /opt/gstreamer/gstreamer-0.10.25. Ce lien nous permet d’avoir plusieur version de GStreamer sur notre système.
sudo cp /opt/gstreamer/gstreamer-0.10.25/lib/gstreamer-0.10.25/* /opt/gstreamer/gstreamer-0.10.25/lib/
sudo ln -s /opt/gstreamer/gstreamer-0.10.25/lib /opt/gstreamer/current
On teste enfin l’installation:
/opt/gstreamer/gstreamer-0.10.25/bin/gst-inspect –gst-plugin-path=/opt/gstreamer/current
Pour les plus faineant, voici un script sheel automatisant ces quelques taches
#!/bin/sh # A simple script to get/compile/install GStreamer # Nicolas Hennion - GPL # # Remarks: the version will be installed in the /opt/gstreamer folder # Change this to the latest version GST_CORE=0.10.25 GST_BASE=0.10.25 GST_GOOD=0.10.17 GST_BAD=0.10.17 GST_UGLY=0.10.13 GST_FFMPEG=0.10.8 # Do not edit under this line sudo aptitude build-dep gstreamer0.10-ffmpeg gstreamer0.10-plugins-bad gstreamer0.10-plugins-bad-multiverse gstreamer0.10-plugins-base gstreamer0.10-plugins-good gstreamer0.10-plugins-ugly gstreamer0.10-plugins-ugly-multiverse sudo aptitude install bison flex git if [ ! -e gstreamer-$GST_CORE.tar.gz ] then wget http://gstreamer.freedesktop.org/src/gstreamer/gstreamer-$GST_CORE.tar.gz fi if [ ! -e gst-plugins-base-$GST_BASE.tar.gz ] then wget http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-$GST_BASE.tar.gz fi if [ ! -e gst-plugins-good-$GST_GOOD.tar.gz ] then wget http://gstreamer.freedesktop.org/src/gst-plugins-good/gst-plugins-good-$GST_GOOD.tar.gz fi if [ ! -e gst-plugins-bad-$GST_BAD.tar.gz ] then wget http://gstreamer.freedesktop.org/src/gst-plugins-bad/gst-plugins-bad-$GST_BAD.tar.gz fi if [ ! -e gst-plugins-ugly-$GST_UGLY.tar.gz ] then wget http://gstreamer.freedesktop.org/src/gst-plugins-ugly/gst-plugins-ugly-$GST_UGLY.tar.gz fi if [ ! -e gst-ffmpeg-$GST_FFMPEG.tar.gz ] then wget http://gstreamer.freedesktop.org/src/gst-ffmpeg/gst-ffmpeg-$GST_FFMPEG.tar.gz fi sudo mkdir /opt/gstreamer if [ ! -e gstreamer-$GST_CORE ] then tar zxvf gstreamer-$GST_CORE.tar.gz cd gstreamer-$GST_CORE ./configure --prefix=/opt/gstreamer/gstreamer-$GST_CORE make sudo make install cd .. fi if [ ! -e gst-plugins-base-$GST_BASE ] then tar zxvf gst-plugins-base-$GST_BASE.tar.gz cd gst-plugins-base-$GST_BASE PKG_CONFIG_PATH=/opt/gstreamer/gstreamer-$GST_CORE/lib/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig ./configure --prefix=/opt/gstreamer/gstreamer-$GST_CORE make sudo make install cd .. fi if [ ! -e gst-plugins-good-$GST_GOOD ] then tar zxvf gst-plugins-good-$GST_GOOD.tar.gz cd gst-plugins-good-$GST_GOOD PKG_CONFIG_PATH=/opt/gstreamer/gstreamer-$GST_CORE/lib/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig ./configure --prefix=/opt/gstreamer/gstreamer-$GST_CORE make sudo make install cd .. fi if [ ! -e gst-plugins-bad-$GST_BAD ] then tar zxvf gst-plugins-bad-$GST_BAD.tar.gz cd gst-plugins-bad-$GST_BAD PKG_CONFIG_PATH=/opt/gstreamer/gstreamer-$GST_CORE/lib/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig ./configure --prefix=/opt/gstreamer/gstreamer-$GST_CORE make sudo make install cd .. fi if [ ! -e gst-plugins-ugly-$GST_UGLY ] then tar zxvf gst-plugins-ugly-$GST_UGLY.tar.gz cd gst-plugins-ugly-$GST_UGLY PKG_CONFIG_PATH=/opt/gstreamer/gstreamer-$GST_CORE/lib/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig ./configure --prefix=/opt/gstreamer/gstreamer-$GST_CORE make sudo make install cd .. fi if [ ! -e gst-ffmpeg-$GST_FFMPEG ] then tar zxvf gst-ffmpeg-$GST_FFMPEG.tar.gz cd gst-ffmpeg-$GST_FFMPEG PKG_CONFIG_PATH=/opt/gstreamer/gstreamer-$GST_CORE/lib/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig ./configure --prefix=/opt/gstreamer/gstreamer-$GST_CORE make sudo make install cd .. fi sudo cp /opt/gstreamer/gstreamer-$GST_CORE/lib/gstreamer-$GST_CORE/* /opt/gstreamer/gstreamer-$GST_CORE/lib/ sudo ln -s /opt/gstreamer/gstreamer-$GST_CORE/lib /opt/gstreamer/current /opt/gstreamer/gstreamer-$GST_CORE/bin/gst-inspect --gst-plugin-path=/opt/gstreamer/current





Twitter:
Rss:
7 commentaires
Je ne comprend pas trop comment on peut conseiller ce “make install” qui est super crade, hasardeux et irréversible (oui… le make uninstall ne marche que si on garde les sources ainsi que sa compilation originale, et encore).
Il vaut mieux créer un paquet ubuntu avec dh_make qui fera un paquet propre et sera facile à désinstaller, tu ne crois pas ?
Il y a un détail que je n’avais pas vu : le –prefix=/opt/gstreamer/gstreamer-0.10.23/
donc dans ce cas ça ne fait pas une install crade. Toutes mes excuses pour le commentaire précédent pas très sympathique du coup.
Fatigué, j’ai quand même bondi en voyant ce “make install” et j’ai réagi, mais trop vite.
Je m’excuse encore
Comment ce fait-il que le fait de compiler les dernières libraires de gstreamer preservent la version installée par les depots. Je croyais qu’en compilant une nouvelle version, elle remplacait la précedente. Dans ce cas, on peut alors utilisé 2 versions differentes de gstreamer./
Comment cela fonctionne-t-il dans les applications. Laquelles choisieront-elles et pourquoi ?
Le ppa de pititvi dispose des dernieres versions de gstreamer et de gnonlin pour fonctionner, pourquoi ne pas les prendre ? Vaut-il mieux les compiler ou bien preferer un depot ?
Une dernière question enfin ; dans ton post tres interressant sur ta futut configuration home cinema (auquel je n’ai pas encore repondu) quel version d’ubuntu utilises-tu ; une desktop ou bien une serveur.
En tout cas, à + ici ou bien sur le forum
@Cenwen: l’option –prefix=/opt/gstreamer/gstreamer-0.10.23 permet de configurer GStreamer (et ses plugins) pour qu’il se compile dans un répertoire autre (/opt/gstreamer/gstreamer-0.10.23) que le répertoire système (/usr/lib/gstreamer-0.10). Il est ainsi possible de tester ses applications avec les toutes dernières versions du framework. Pour utiliser la version compilé plutot que la version système, il faut fixer les variables d’environnement suivantes avant de lancer les applications:
export GST_PLUGIN_PATH=/opt/gstreamer/current
export GST_PLUGIN_SYSTEM_PATH=/opt/gstreamer/current
Concernant mon billet sur le home cinema, l’Ubuntu est une version Desktop 9.04.
Merci pour la reponse mais que penses-tu des versions de gstreamer du ppa de pitivi. Sont-elles fiables et interressentes et peuvent-elles cassees le systeme (perso je pense que oui ) et dans ce cas ton tuto devient interressant à essayer puisque c’est sans risque.
Merci pour le “tuto”, tres detaillé, bref nickel, mais j’ai un petit soucis en fait, je suis tout a la lettre…hors, quand je tape “dpkg -l | grep gstreamer” il ni a que la 0.22 d’installé….hors j’ai besoin de la .23 pour pouvoir compiler et installr la derniere SVN de Amsn…
J’ai meme essayé en faisant tout simplement la procedure decrite dans le INSTALL de chaque paquets, mais la aussi, la 0.23 n’apparait pas…..et ca fait une semaine voir plus que je suis sur ce probleme, lol.
Y aurait til une solution pour remedier a ceci ? merci d’avance.
Très bon article d’information et j’en profiterai pour ajouter votre blog dans ma prochaine lettre mensuelle. Merci encore.