MythTV on Playstation3

From MythTV Official Wiki
Jump to: navigation, search

Time.png Outdated: The Playstation 3 no longer supports running linux.

Ps3.png This will be a hub to gather all info around using MythTV on the Playstation 3 (PS3). A MythTV media server (backend) can be accessed in two ways with a PS3: A MythTV frontend running with the "otheros" facility (probably on top of some flavor of Linux). or via Universal Plug-n-Play (UPnP) with the built-in game operating system.

MythTV Frontend

Current status

The MythTV frontend is functional under several PS3 Linux distributions, including Yellow Dog Linux, Gentoo, and Ubuntu. However, video playback is choppy because XVideo (XV) is not available and MythTV falls back to XSHM for playback. In addition, navigating between various menu levels is very slow because the amount of available RAM is limited, especially when running under X11.

  • It is now possible to use a special X driver (xf86-video-spu) to help with playback. Playback is now as smooth as it is with my main PC. Build instructions are available for Ubuntu 7.10, but should work with other distros with small changes as well (link: http://psubuntu.com/forum/viewtopic.php?t=1805 ) . This driver is buggy, but finally allows my PS3 to act as a really nice frontend. I sometimes have to issue a "sudo killall -9 XOrg" to get the driver to die and make gdm restart, but I've scripted this so other PCs in the house can do this semi-automatically via passwordless SSH login (my non-geek girlfriend can do it, so it's fairly easy). Sometimes the video comes out as garbage as well. But if I just quit mythtv and let X restart, it works okay again. There is a little bit of 'tearing' visible at times, but it's easy to ignore.
This driver is buggy, but it really goes seem to be a silver bullet for allowing smooth video playback with mythtv, especially as it requires no changes to mythtv itself, only the addition of a driver. This is best solution for PS3 owners until mythtv has proper support for the SPUs inside the PS3. Later on, I expect mythtv will make use of the medialib project to use the SPUs to aide in the decoding of streams, as well as displaying them.
  • Yellow Dog Linux has packages available from atrpm.
  • Ubuntu has an 'ubuntu-mythtv-frontend' meta-package which will install the frontend software and configure the GDM login screen to automatically log in as the 'mythtv' user and start the frontend. The first time the system starts, this login occurs immediately. If the user quits the frontend, a login screen will be displayed with a 5-second timeout (goes up to 30 seconds if you start typing another login name). Notes from User:Mulad, January 2008:
I started with Feisty Fawn (7.04) and was able to upgrade to Gutsy Gibbon (7.10). Note that if you do this upgrade, you should be sure to install the 'linux-image-cell' kernel (or is that 'kernel-image-cell'?), as the regular powerpc64-smp kernel for Gutsy doesn't work.
Recorded TV playback under MythTV is unacceptably slow. mplayer works better, but still has significant issues. With a standard mplayer, it's possible to view SD video in a window with the options '-vo x11 -zoom -vf kerndeint' and have it play acceptably deinterlaced. Scaling video to fullscreen is problematic. I also attempted 1080i60 video (essentially 1080p30), but deinterlacing was not practical and the playback quickly lost sync unless the '-framedrop' option was used. This leads me to believe that "filmed" 1080p24 content would be able to play quite smoothly. (Hmm, where's that de-telecine option again?)
  • Gentoo - notes from User:Shyru, March-April 2007:
I have installed Gentoo on my PS3 to start experimenting with DirectFB. DirectFB 1.0.0 compiled cleanly. I rebuilt SDL with directfb-support, and compiled mplayer with directfb support.
Unfortunately, mplayer does not work with directfb or sdl, it always crashes at some point. I still need to figure out why. Though the test-program DFBPoint does work nicely. When run with --dfb:mode=1280x720 it entered fullscreen nicely, but some of the slide-animations where a little bit sloppy. I wonder if Mythtv would run smooth via directfb if there is no hardware acceleration.
I have now successfully emerged qt-embedded. After that I checked out the mythtv-vid branch and compiled it successfully. It even starts fine in fullscreen mode (1280x720), the menu is shown, keyboard works. Unfortunatly the mythtv-vid branch contains some changes from upstream and this made the mythfrontend incompatible with my backend running on my server (My Server has protocol 31, the mythtv-vid-branch currently 33) so i could not check how video-playback would run.
However I made some tests with mplayer: When I just call it without parameters (no -vo=directfb) it works through sdl and that uses fbcon. It even scales to full 720p. However playback of HD-material is very choppy and not fluid at all. SD-material runs nearly smooth. Then I started the X server and used mplayer with the X11 driver. SD-material and material slightly over SD runs very smooth and great. Sadly the X11 driver cannot scale to fullscreen, which is very odd. HD-material (720p) runs better than under the console, but not even near the full framerate. Interestingly i heard of people running mplayer with Full-HD videos (1080p) under X and they said it was smooth as silk.

Playstation 3 hardware issues

There are 2 major issues that need to be addressed when running Linux/mythtv on the PS3:

Memory

There is only around 200MB of memory available for Linux to work with. As a result, Mythtv can be slow to start up and switch between menu pages as theme detail is swapped from the harddisk to main memory. Running Mythtv at 1080 can be painfully slow.

The main way of reducing memory consumption is to run Mythtv without the overhead of X11, window managers etc. This can be achieved by installing qt-embedded and building Mythtv to use it instead of the default qt.

Displaying video

Sony has restricted any direct access to the video hardware. All rendering is via a memory backed framebuffer and all colour conversion, scaling etc for video playback must be done in software. Mythtv will happily play standard definition video but will skip a lot of frames due to this conversion overhead.

To improve performance we need to use the six additional processors (SPUs) that are available on the PS3. By offloading the heavy work of colour conversion and scaling, we can leave the main processor (PPU) to concentrate on video decoding, sound, osd, event handling etc.

Remote control

Other less serious issues include the lack of a serial port, so serial lirc interfaces will not work on the PS3 (though a USB serial adapter could theoretically work). Either use a keyboard (wireless or wired) or a USB lirc receiver.

Alternatively, the sixaxis wireless controller should work with a more recent or patched kernel and a custom joystick config file. See http://www.pabr.org/sixlinux/sixlinux.en.html (wireless) and http://ps3.jim.sh/sixaxis/usb (wired).

Development status/TODO

qt embedded

qt embedded compiled and installed under Gentoo. Need to compile MythTV with this for work properly.

DirectFB

Mythtv video playback does not currently work with DirectFB on the PS3. As far as I can tell, DirectFB really needs a new driver to deal with the specifics of the PS3 framebuffer. (Note: playback fails because there is no video layer available from directfb). Given the unique combination of the ps3 framebuffer and the 6 SPUs available, I'm focusing on a mythtv video method for the ps3 (see below)

Sixaxis controller

Need to compile a patched kernel to test sixaxis input in wireless mode.

YellowdogLinux 5.0 supports the sixaxis 'out of the box' in usb mode. See below for an example joystick config file.

Video display

User:Mark kendall reports, May 2007

I've written a new video output method for mythtv on the PS3. This takes control of the framebuffer directly and coordinates vertical synchronisation, buffer flipping etc. It also offloads all colour conversion and video scaling to one or more SPU's.

  • Working:
    • Colour conversion on SPUs.
    • vertical sync
  • TODO
    • Scaling
    • xrandr support (PS3 has a very clear set of supported display modes)
    • osd blending
    • full size osd
    • pip


  • Exit option - Boot GameOS
  • Done - added an extra (configurable) option to the exit menu that boots into the Sony game OS.

spu-medialib

spu-medialib appears to be under active development, a library that can dispatch various decoding activities to be handled with one or more of the SPUs within the Cell processor. This appears to be initially built for an mplayer variant named 'mplayer-vo', but could be used for MythTV.

Sixaxis controller config file for use with Mythfrontend

This should work on a default YellowdogLinux 5.0 install.

# Joystick menu config file for mythtv using Sixaxis controller
#  Place in ~/.mythtv/

# N.B. Not all buttons and axis have been implemented

devicename /dev/js0

# select
button 0                    Enter
# L3
button 1                    Enter
# R3
button 2                    Enter
# Start
button 3                    Enter 
# Dpad Up
button 4                    Up
# Dpad right
button 5                    Right
# Dpad down
button 6                    Down
# Dpad left
button 7                    Left

# triangle
button 12                   M
# Circle
button 13                   Escape
# Cross
button 14                   Enter
# Square
button 15                   I
# PS Button
button 16                   Enter


# left thumb
axis   0    -32767  -15000  Left
axis   0     15000   32767  Right
axis   1    -32767  -15000  Up
axis   1     15000   32767  Down

# right thumb
axis   2    -32767  -15000  Left
axis   2     15000   32767  Right
axis   3    -32767  -15000  Up
axis   3     15000   32767  Down

Information found on the web

For now I found the following interesting bits of information regarding MythTV on the ps3:

Framebuffer related

General bits of information

Whats next?

User:Shyru says, March-April 2007:

Since I don't want to go SVN in my mythtv-network (one server, 2-3 frontends) i am stuck a little bit because I cannot try the frontend i compilde. Does anyone have an Idea on how to build a second mythbackend server with a newer version on the same machine as the real server and run them simultanously? Or could i run one in a virtual machine? But from where would i get some recordings to test video-playback then? Any Ideas?

Until I have a solution to the above problem, consider this project on halt.

-- Set up a second user with custom 'PATH' and 'LD_LIBRARY_PATH' variables pointing to a second installation of mythtv. Have the second user set up to run on a separate mysql database and different ports.


Anyway I will probably test a little bit more with mplayer and see how i may optimize playback. Perhaps there are some workarounds to at least play back recordings in an easy and comfortable way. (UPnP and djmount come to mind)

I will report back when there is progress...

PS3 Game OS/UPnP

When there is a MythTV backend is set up to serve data over a network, it also has a Universal Plug-n-Play function enabled by default (provided the backend is using a "real" IP address--127.0.0.1 makes the backend disable uPnP functionality). The backend will appear in the Playstation home menu under the Music and Videos sections as "hostname: MythTV AV Media Server". With this, it is possible to browse music, videos, and recorded TV. However, many of the codecs commonly used with MythTV don't currently work with this functionality. MPEG2 video appears to work, but ATSC (US digital/HDTV standard) videos don't seem to have any audio (connected to a MythTV 0.20.2.svn20071210-0 backend running Debian). Ogg Vorbis is also reportedly unsupported. MPEG4 recording created by MythTV don't appear to work at all, appearing as "Unsupported Data" in the PS3 game OS.

-- ATSC audio still does not work, however most recent MPEG4 ASP stuff does. DivX4+ and Xvid seem to work fine, but DivX3.11a is still not supported. -wagnerrp jun-11-2008

-- As of PS3 Firmware 2.50, ATSC audio seems to be fixed (suspect it was problem with the large audio delay values). Sporadic ATSC MPEG2 recordings still come up as unsupported. -jswinth NOV-18-2008

-- PS3 Firmware 2.60 added support for playing Divx3.11 --Ruleke 19:29, 29 January 2009 (UTC)

-- The PS3 seems to do a poor job of recognizing albums in MythMusic as albums, and tends to display each item in an album as if it were many albums with the same name and one track each. -- Dagmar d'Surreal 21:34, 3 November 2009 (UTC)