Friday, February 8, 2008

GStreamer Codec Install Gone Bad?

Sometime before linux.conf.au I purchased the Fluendo binary codecs for GStreamer so I could transcode a bunch of WMA music I acquired into something more useful.

I've had the chance tonight to sit down and play with them -- I followed the instructions for a user based installation, namely, create a directory called .gstreamer-0.10/plugins in my home directory, untar the bundle into this directory and run /usr/bin/gst-inspect in order to update the registry to recognise them.

This part went smoothly enough, running gst-inspect-0.10 | grep flu I get:

flump3dec: flump3dec: Fluendo MP3 Decoder (C build)
flumpeg2vdec: flumpeg2vdec: Fluendo MPEG-2 Video Decoder
fluisodemux: fluisodemux: ISODemux Demuxer
flumms: flummssrc: Fluendo MMS source
fluasf: fluasfdemux: Fluendo ASF Demuxer
fluasf: fluasfcmdparse: Fluendo ASF Command Parser
fluh264dec: fluh264dec: Fluendo H264 Decoder
fluac3dec: fluac3dec: AC3 decoder
fluwmvdec: fluwmvdec: Fluendo WMV Decoder
flumpegdemux: flupsdemux: MPEG Program Demuxer
flumpegdemux: flutsdemux: MPEG Transport stream demuxer
flumcaacdec: flumcaacdec: Fluendo AAC Decoder
flumpeg4vdec: flumpeg4vdec: Fluendo MPEG-4 ASP Video Decoder
fluwma: fluwmadec: Fluendo WMA Decoder
fluwma: fluwmsdec: Fluendo WMS Decoder
However, the WMA codec doesn't load -- instead, the Ubuntu 'easy codec installer' tells me that I should go off and install the gstreamer0.10-ffmpeg package, which, while being nice in theory ... is not what I just paid 40-odd euros for.

Then I fired up Totem from the command line using: totem --gst-debug-level=2 (which outputs minimal debug spew to the console) and found:

0:00:04.868806000 19249 0x809b470 WARN GST_PLUGIN_LOADING gstplugin.c:459:gst_plugin_load_file: module_open failed: /home/paul/.gstreamer-0.10/plugins/libgstflumpegdemux.so: failed to map segment from shared object: Operation not permitted

(totem:19249): GStreamer-WARNING **: Failed to load plugin '/home/paul/.gstreamer-0.10/plugins/libgstflumpegdemux.so': /home/paul/.gstreamer-0.10/plugins/libgstflumpegdemux.so: failed to map segment from shared object: Operation not permitted
0:00:04.868982000 19249 0x809b470 WARN GST_PLUGIN_LOADING gstplugin.c:928:gst_plugin_load_by_name: load_plugin error: Opening module failed: /home/paul/.gstreamer-0.10/plugins/libgstflumpegdemux.so: failed to map segment from shared object: Operation not permitted
0:00:04.869028000 19249 0x809b470 WARN GST_PLUGIN_LOADING gstpluginfeature.c:132:gst_plugin_feature_load: Failed to load plugin containing feature 'flupsdemux'.
0:00:04.869073000 19249 0x809b470 WARN GST_ELEMENT_FACTORY gstelementfactory.c:406:gst_element_factory_create: loading plugin returned NULL!
0:00:04.869115000 19249 0x809b470 WARN decodebin gstdecodebin.c:909:try_to_link_1: could not create an element from flupsdemux
0:00:04.871628000 19249 0x80d5748 WARN GST_PLUGIN_LOADING gstplugin.c:459:gst_plugin_load_file: module_open failed: /home/paul/.gstreamer-0.10/plugins/libgstflumpeg2vdec.so: failed to map segment from shared object: Operation not permitted

(totem:19249): GStreamer-WARNING **: Failed to load plugin '/home/paul/.gstreamer-0.10/plugins/libgstflumpeg2vdec.so': /home/paul/.gstreamer-0.10/plugins/libgstflumpeg2vdec.so: failed to map segment from shared object: Operation not permitted
0:00:04.871677000 19249 0x80d5748 WARN GST_PLUGIN_LOADING gstplugin.c:928:gst_plugin_load_by_name: load_plugin error: Opening module failed: /home/paul/.gstreamer-0.10/plugins/libgstflumpeg2vdec.so: failed to map segment from shared object: Operation not permitted
0:00:04.871697000 19249 0x80d5748 WARN GST_PLUGIN_LOADING gstpluginfeature.c:132:gst_plugin_feature_load: Failed to load plugin containing feature 'flumpeg2vdec'.
0:00:04.871713000 19249 0x80d5748 WARN GST_ELEMENT_FACTORY gstelementfactory.c:406:gst_element_factory_create: loading plugin returned NULL!
0:00:04.871727000 19249 0x80d5748 WARN decodebin gstdecodebin.c:909:try_to_link_1: could not create an element from flumpeg2vdec
0:00:04.873951000 19249 0x80d5748 WARN mpegdemux gstmpegdemux.c:767:gst_mpeg_demux_parse_packet: unknown stream id 0xbe
0:00:04.874523000 19249 0x80d5748 WARN GST_PLUGIN_LOADING gstplugin.c:459:gst_plugin_load_file: module_open failed: /home/paul/.gstreamer-0.10/plugins/libgstflump3dec.so: failed to map segment from shared object: Operation not permitted

(totem:19249): GStreamer-WARNING **: Failed to load plugin '/home/paul/.gstreamer-0.10/plugins/libgstflump3dec.so': /home/paul/.gstreamer-0.10/plugins/libgstflump3dec.so: failed to map segment from shared object: Operation not permitted
0:00:04.874568000 19249 0x80d5748 WARN GST_PLUGIN_LOADING gstplugin.c:928:gst_plugin_load_by_name: load_plugin error: Opening module failed: /home/paul/.gstreamer-0.10/plugins/libgstflump3dec.so: failed to map segment from shared object: Operation not permitted
0:00:04.874586000 19249 0x80d5748 WARN GST_PLUGIN_LOADING gstpluginfeature.c:132:gst_plugin_feature_load: Failed to load plugin containing feature 'flump3dec'.
0:00:04.874609000 19249 0x80d5748 WARN GST_ELEMENT_FACTORY gstelementfactory.c:406:gst_element_factory_create: loading plugin returned NULL!

Operation not permitted?

Removing the .gstreamer-0.10/plugins directory fired up the MAD mp3 decoder, which was what it should have done, but that still didn't use the binary codecs.

Looking at /etc/fstab gave me the answer:

UUID=d85165d4-57a0-4f75-b5b1-a07fb8a5c444 /home ext3 nodev,noexec,nosuid 0 2


Needed to be:

UUID=d85165d4-57a0-4f75-b5b1-a07fb8a5c444 /home ext3 nodev,nosuid 0 2


In other words, you need to explicitly allow executables within your home directory by removing the noexec option.

(Of course, if you're not as paranoid about launching binaries from your home directory as I am, making nodev,nosuid just say defaults again will work for you too.)

Rebooted the machine & instantly files using the new codecs started playing correctly.

Probably something that won't happen to everyone, but it was a nice gotcha that kept me amused for an hour or two before :)

note: Your UUID will differ from mine too, just by the by -- there's no need to edit that part, just the mount options.

note ii: Fluendo seem to use OSCommerce for their shop, I wonder if they've after heard of Shop Of Shops?