Friday, September 18, 2009

Trying Out Rygel

Trying out the new, integrated into GNOME and uses GStreamer -- Media Sharing daemon, Rygel.

First thoughts, it's a _lot_ easier to configure than Mediatomb -- I am using the "media export" plugin because my Ubuntu Jaunty installation is rather bastardised, so Tracker is "unreliable at best" on my system.

I'm using the packages from James Henstridge's PPA Repository -- because they're available for Jaunty, as well as the Vala Compiler from their PPA.

Getting it going with the PS3 was easy though, first of all -- I disabled the LPCM transcoding (for some reason, none of my MP3's appeared until I did that), by unchecking the tickbox -- set the interface to wlan0, added my media directory -- and away we went.

Still have the odd issue where Wirelessly, my PS3 doesn't see anything exported from the Ubuntu box -- but i'm figuring that's more a router issue, more than an Ubuntu one -- having recently experimented with Fedora as well.

PackageKit, The Superior update-manager Alternative

So, Dad decided to mess with his Ubuntu installation over the weekend -- he upgraded from Hardy to Jaunty as a one-step upgrade, which, somewhat unsurprisingly, broke heaps of stuff.

(personal opinion: It is for this reason, I hope the Ubuntu guys don't go head-long into GNOME 3.0 for "whatever-the-hell-the-L-release-is-called" if it's going to be a standard 6-month release cycle AND an LTS -- because they'll have people from 8.04 or 6.06 triggering ungrades and no-one wants a repeat of the PulseAudio debacle but on a far bigger scale. Either a) leave GNOME 2.28, continue polishing it and push GNOME 3.0 for the release after the LTS, so it gets three releases (or 2 years) of polish before it goes to the masses, or b) make the release cycle 6 months longer for an LTS, just like 6.06 was, but for the right reasons.)

Anyway, after re-installing Jaunty from scratch, fixing his RAID, re-installing his printer and playing with DKMS because his nVidia card doesn't like the newest driver in Jaunty, but will happily work with anything older -- we tripped over the 'incredible, vanishing update manager issue'.

(personal opinion II: big, big cock-up on the part of the Ubuntu guys -- Windows has an update icon, MacOSX has an update icon, every other distribution of UNIX has an update icon, but a 50+ year old man can have a taskbar full of update-manager windows, which makes the one browser window icon in the window list appear as 3-pixels wide because he doesn't understand he has to close them all individually? It would have been better to pop up a dialogue in the middle of the screen that says "Security Updates Are Available for Your Computer, would you like to install them now?" (or "Non-Essential Updates" in the case of non-security updates), or leave the icon where it was and hack in OSD notifications (like NetworkManager does) -- but don't just leave a glowing taskbar window in the bottom left hand corner, UI or Accessibility designers would turn in their graves.)

Anyway ... Given the track record that Ubuntu has for making seat-of-the-pant changes like that and taking forever to admit it was a mistake and reverting it to sensible behaviour, I decided to give PackageKit a try.

Short story -- impressive.

Installation was a simple: apt-get -f install packagekit packagekit-gnome gstreamer0.10-packagekit

The Ubuntu packages in Jaunty do add a duplicate "Update Manager" icon to the System ⇢ Administration menu, but that's purely cosmetic -- upon install it does make itself the default package update manager, which is a step in the right direction.

I have always been concerned about the way updates are presented for non-technical users, Microsoft nearly has it right -- too much information scares the non-technical user, but most UNIX variations give too much superfluous information to the user, great for technical types who actually fix issues -- and certainly something that shouldn't be removed, just 'shielded' from the user somehow).

PackageKit does this well, it gives the user notification that updates are pending in the standard way (which was our major gripe that prompted the change) but is also laid out in such a way that Dad found easier to drive than the traditional package manager (as he put it, "I already like the idea you can press a button to review changes before they happen.").

As I may of mentioned before in this blog, my dad is not a unintelligent man, he's been involved with computers, electronics, data communications, radio and just about any other form of technology you'd care to mention forever -- we've worked together on some massive projects, including hardware design, starting our own UNIX distribution and starting up smaller technology projects together -- and he has been a Linux user for nearly 5 years himself, but he's firmly a "a computer is a tool, just make the thing work" man, rather than a "let's experiment" one.

(He also builds RC Boats for a hobby, which is just cool.)

"Network Error 00000000", The PS3 and Mediatomb

After requiring a fresh install of Ubuntu on my media-serving laptop due to disc failure -- I restored all the configuration settings from a backup, re-imported my library into Mediatomb, restarted the daemon and wandered into the lounge to watch TV via the PS3, a ritual with the two evening coffees before the cricket starts.

However, last night -- something strange kept happening, I could browse the videos, they even had thumbnails, but when I attempted to play them, a black screen would appear with "Network Error (000000000)".

Checked the configuration, checked the router settings, checked the wireless signal strength, all fine. (then figured, "paul, you'd not be able to see anything if these settings didn't work ;)")

Googled, no luck there either -- hence this post.

Enabled debugging mode by editing the /etc/default/mediatomb file and changing OPTIONS="" to OPTIONS="-D" and restarted the daemon and loaded up the /var/log/mediatomb.log file to find:



2009-09-17 23:34:00 DEBUG: [../src/io_handler_buffer_helper.cc:224] staticThreadProc(): starting buffer thread... thread: -1267590256
2009-09-17 23:34:02 DEBUG: [../src/process_io_handler.cc:234] read(): process exited with status 256
2009-09-17 23:34:02 DEBUG: [../src/io_handler_buffer_helper.cc:227] staticThreadProc(): buffer thread shut down. thread: -1267590256



Hmm, status 256 you say? "Could be something to do with the encoding then?" I thought.

Running ffmpeg -i testvideo.wmv -target dvd -y testvideo-ps3.avi from the command line, indeed gave me my answer:



Unknown encoder 'mpeg2video'



Turns out, the default ffmpeg installation for Ubuntu Jaunty and Karmic have mpeg2video support in ffmpeg disabled.

Two ways to fix this, the first is to implement a much, much, much longer command to encode your videos -- I use a generic script to encode videos based on their content type, but the PS3 can play (from Firmware 2.61, 3.00 and 3.01 anyway) anything encoded with the DVD profile (which encodes to MPEG2 based AVI's via the aforementioned mpeg2video codec), so instead of:

ffmpeg -i "$input" -target dvd -y "$output"

You'd use:

ffmpeg -i "$input" -vcodec mpeg1video -mbd rd -trellis 2 -cmp 2 -subcmp 2 -b 1500 -g 250 -y "$output"

(note: those commands are the only ones that are essential for making the video output work on the PS3, it'll produce a standards-compliant MPEG file with 64k MP2 audio -- but the quality may look suspect, as long as you leave those commands in, you can add things like "-flags qprd", "-bf 2" or "-flags +ilme+ildct" (good for interlaced video like animation) to improve the quality slighly)

Or, you can install the alternative versions of FFMPEG by enabling the multiverse repository (System ⇢ Administration ⇢ Software Sources) and then installing the -unstripped versions of FFMPEG with the command:

sudo apt-get -f install libavcodec-unstripped libavformat-unstripped

... and continue using the transcoding scripts you're using now :)

How can I tell if I have a broken FFMPEG installation?



The simplest way is to run: ffmpeg -formats | grep mpeg2video from the command line, if you receive:



D VSDT mpeg2video



Then you're missing the 'E'ncoding aspect of the codec, meaning you need to install the unstripped packages to make everything work correctly.

If it returns:



DEVSDT mpeg2video



Then you're all set to go :)