HOWTO: PS3 Media Server on Ubuntu 9.10 karmic koala

For help and support with issues specific to Linux/Unix
Forum rules
Please make sure you follow the Problem Reporting Guidelines before posting if you want a reply.

HOWTO: PS3 Media Server on Ubuntu 9.10 karmic koala

Postby industrai » Tue Nov 03, 2009 2:36 am

After doing a bit of digging I was able to get PS3 Media Server SVN running on Ubuntu 9.10 64bit, with the ability to play hd x264 mkv files utilizing the latest and greatest mplayer, mencoder, and ffmpeg, Hopefully this helps others in a similar situation. These steps should also work on a 32bit system.

Note that this worked for me, but I can't guarantee that it won't completely destroy your computer, so use at your own risk.

Installing ffpmeg, x264, mplayer and mencoder

First, follow these instructions to install the very latest ffmpeg and x264:
http://ubuntuforums.org/showthread.php?t=786095
(svn x264 is required for compiling x264. ffmpeg can be omitted if you plan on using ffmpeg-mt fore multicore cpu utilization, see below)

Next remove mplayer and mencoder from your system by issuing the following command:
Code: Select all
sudo apt-get remove mplayer-nogui mencoder


Next, follow these instructions to install the very latest mplayer:
http://ubuntuforums.org/showthread.php?t=1305181
(Optionally, if you would like to use the multi-threaded branch of mplayer ffmpeg-mt for better performance with multi-cpu configured PCs, use these instructions as well:
http://ubuntuforums.org/showthread.php?t=1049449)

During this section of the guide:
Code: Select all
$ cd $HOME/mplayer
$ ./configure --cc=gcc-4.3 --confdir=/etc/mplayer --disable-mencoder --disable-x264
$ make
$ sudo checkinstall -D --install=yes --fstrans=no --pakdir "$HOME/Desktop" \
   --pkgname mplayer-nogui --backup=no --deldoc=yes --deldesc=yes --delspec=yes --default \
   --pkgversion "3:1.0~svn-`grep "#define VERSION" version.h | cut -d"-" -f2`"
$ make distclean


We want to REMOVE the "--disable-mencoder --disable-x264" from the command, so that mencoder and x264 support are compiled. The command should look like this:

Code: Select all
./configure --cc=gcc-4.3 --confdir=/etc/mplayer


Once you are finished with the guide, make sure you can play movie files with smplayer before continuing.

RAR Playback fix
In order to play/encode files from within rar archives, the cache=2048 switch must be used. We can control this switch from command line by issuing something like
Code: Select all
unrar p -inul test.rar|mplayer -cache=2048 -

but we cannot control it from within PS3 media server. As a workaround, you can add or uncomment it in your mencoder configuration file.
Code: Select all
gedit $HOME/.mplayer/.mencoder.conf
and add the line
Code: Select all
cache=2048


optionally you can do the same to your $HOME/.mplayer/config file.

Compile the latest SVN of ps3 media server

First, install the JDK and ant.
Code: Select all
sudo apt-get install sun-java6-jdk ant


Next, change to your home directory and download the SVN of PS3 Media server:
Code: Select all
cd ~

Code: Select all
svn checkout http://ps3mediaserver.googlecode.com/svn/trunk/ ps3mediaserver-read-only


Once that completes, we can go into the directory where the PS3 Media Server code is downloaded and compile it with ant
Code: Select all
cd ps3mediaserver-read-only/ps3mediaserver
ant



You have to make sure that PMS.sh has execute permissions on it.
Code: Select all
chmod u+x PMS.sh


You also might have to do the same thing to tsMuxeR, located in the linux directory.
Code: Select all
cd linux
chmod u+x tsMuxeR


Next, move ps3mediaserver to your home directory and remove the ps3mediaserver-read-only directory.
Code: Select all
cd ~
mv ps3mediaserver-read-only/ps3mediaserver .
rm -rf ps3mediaserver-read-only


Done!

Now you can run ps3 media server by changing to the ps3mediaserver directory
Code: Select all
cd ps3mediaserver

and typing
Code: Select all
./PMS.sh
.

Tweaks
I was having an issue skipping forward on certain movies. It would only allow me to skip, say 1 hour forward. Any further than that and the movie would pause and I couldn't start it. Upon examining the logs and reviewing some forum posts, it was determined that tsMuxeR was the problem. Within PS3MediaServer, I completely disabled tsmuxer, and I no longer have this issue.

Make PS3 Media Server start on login

PMS.sh HAS to be ran from the directory it is in... if you run it by typing /home/username/ps3ms/PMS.sh, you will get errors when playing your files, and if you click on the README tab or FAQ tab, they will be blank. This is because it uses relative paths in it's code. The only correct way to run PMS.sh is to first cd into the directory, then run ./PMS.sh.

It is because of this, that when you try to run PMS.sh from your Startup programs, you will run into issues trying to play movie files. To get around this, create a script file that will first cd into the directory, and then run PMS.sh.

Create a file in your home directory called start-pms.sh, with a text editor add the following to it:
Code: Select all
#!/bin/sh
cd /home/username/ps3mediaserver
./PMS.sh


you'll want to give that file execute permissions

Code: Select all
chmod u+x start-pms.sh


Next, click System > Preferences > Startup Applications

Click Add..

Name: PS3 Media Server
Command: /home/username/start-pms.sh

Click Add.

Click close. Now the next time you log in, you should see PS3 Media Server start. I check "start minimized" under general configuration so that I don't get the main window each time I log in.
Last edited by industrai on Wed May 05, 2010 3:59 pm, edited 11 times in total.
industrai
 
Posts: 34
Joined: Tue Nov 03, 2009 2:07 am

Re: HOWTO: PS3 Media Server on Ubuntu 9.10 karmic koala

Postby meskibob » Tue Nov 03, 2009 3:38 am

Thanks for the how to.
I have linked it into the tutorial thread: viewtopic.php?f=6&t=3507&p=15382#p15382
I provide NO application support via PM or email, so please post your question to the forum per the Forum Rules.
meskibob
Moderator
 
Posts: 4768
Joined: Mon Jan 19, 2009 4:11 pm

Re: HOWTO: PS3 Media Server on Ubuntu 9.10 karmic koala

Postby bau » Wed Nov 04, 2009 11:27 pm

hello

been following your excellent guide and been trying to get ps3media server to work in ubuntu 9.10.
everything seems to go smoothly until im going to start it, i write ./PMS.sh and i get the following: bash: ./PMS.sh: Permission denied
i try run it as sudo ./PMS.sh but all i get is a sudo: ./PMS.sh: command not found

what am i doing wrong?.. im pretty new to all this with linux/ubuntu
bau
 
Posts: 3
Joined: Wed Nov 04, 2009 11:21 pm

Re: HOWTO: PS3 Media Server on Ubuntu 9.10 karmic koala

Postby industrai » Wed Nov 04, 2009 11:34 pm

You have to make sure that PMS.sh has execute permissions on it.
Code: Select all
chmod a+x PMS.sh

will make PMS.sh executable.

You also might have to do the same thing to tsMuxeR, located in the linux directory.
Code: Select all
cd linux
chmod a+x tsMuxeR


The other option is to run
Code: Select all
sh ./PMS.sh


I'll update the guide to include this.
industrai
 
Posts: 34
Joined: Tue Nov 03, 2009 2:07 am

Re: HOWTO: PS3 Media Server on Ubuntu 9.10 karmic koala

Postby bau » Wed Nov 04, 2009 11:38 pm

yaay! it worked .)

thank you so much for the quick answer!
bau
 
Posts: 3
Joined: Wed Nov 04, 2009 11:21 pm

Re: HOWTO: PS3 Media Server on Ubuntu 9.10 karmic koala

Postby industrai » Thu Nov 05, 2009 1:12 am

no problem. I'm glad it helped someone.
industrai
 
Posts: 34
Joined: Tue Nov 03, 2009 2:07 am

Re: HOWTO: PS3 Media Server on Ubuntu 9.10 karmic koala

Postby trickards » Thu Nov 05, 2009 2:35 pm

Thanks for this. :D

Is the version of mencoder on svn multithreaded now? or do we still need to faff around building in ffmpeg-mt?
trickards
 
Posts: 10
Joined: Thu Jul 09, 2009 11:17 pm

Re: HOWTO: PS3 Media Server on Ubuntu 9.10 karmic koala

Postby bau » Thu Nov 05, 2009 9:14 pm

after a computer restart im getting following when starting PMS:
Toolkit error: Can't load library: /usr/lib/jvm/java-6-openjdk/jre/lib/amd64/xawt/libmawt.so
GUI environment no available
Switching to console mode

PMS itself works great but it's not starting the GUI..
any idea how to fix that?
bau
 
Posts: 3
Joined: Wed Nov 04, 2009 11:21 pm

Re: HOWTO: PS3 Media Server on Ubuntu 9.10 karmic koala

Postby t4it » Fri Nov 06, 2009 1:29 am

bau wrote:after a computer restart im getting following when starting PMS:
Toolkit error: Can't load library: /usr/lib/jvm/java-6-openjdk/jre/lib/amd64/xawt/libmawt.so
GUI environment no available
Switching to console mode

PMS itself works great but it's not starting the GUI..
any idea how to fix that?


I found that the Java variables set above are only temporary to that terminal session.

So every time you open terminal to access the GUI you have to;

Code: Select all
JAVA_HOME=/home/YOUR_UBUNTU_USERNAME/Downloads/jdk1.6.0_16/jre


then

Code: Select all
export JAVA_HOME


once you do that go to the directory pf ps3ms;

Code: Select all
cd ps3mediaserver-read-only/ps3mediaserver


then run the application, it should open the GUI;

Code: Select all
./PMS.sh


I'll try find out how to set the Java HOME permanently to your own directory, or you could try and move the jre folder to the specific spot where your error message suggests it want's to find it (Haven't tried this, so it may not work).

Code: Select all
/usr/lib/jvm/java-6-openjdk/jre


In addition, thank you very much for this guide, very useful! Would like to see it run as a service, this would make things a lot easier!

UPDATE:

Ok, i found out how to set my java variables permanently;

1. Go to your home directory and ctrl+h to see hidden files and folders.

2. Find the file, .bashrc and edit it.

3. At the end of the file add;

Code: Select all
export JAVA_HOME=/home/YOUR_UBUNTU_USERNAME/Downloads/jdk1.6.0_16/jre
export PATH=$JAVA_HOME/bin:$PATH


Open a new terminal window and type java -version to make sure you’re running the java version you expected. Type env and verify that PATH variable contains the path to the JDK that you exported before.


This should set your java variables permanently when you run from a terminal with the command

Code: Select all
./PMS.sh


In the ps3mediaserver directory.

The above works, however, when I run from the GUI and tell it to run in terminal it uses the old java environment variables... very strange considering i physically changed them, could it be hard coded into the application somewhere?

Code: Select all
Toolkit error: Can't load library: /usr/lib/jvm/java-6-openjdk/jre/lib/i386/xawt/libmawt.so
GUI environment no available
Switching to console mode
[main] TRACE 11:57:52.965 Starting Java PS3 Media Server v1.20
[main] TRACE 11:57:52.976 by shagrath / 2008-2009
[main] TRACE 11:57:52.976 http://ps3mediaserver.blogspot.com
[main] TRACE 11:57:52.976 http://code.google.com/p/ps3mediaserver
[main] TRACE 11:57:52.976
[main] TRACE 11:57:52.977 Java 1.6.0_0-Sun Microsystems Inc.
[main] TRACE 11:57:52.977 OS Linux i386 2.6.31-14-generic
[main] TRACE 11:57:52.977 Encoding: UTF-8
[main] TRACE 11:57:52.991 Temp folder: /tmp/javaps3media


i do a java -version after this and it shows;

Code: Select all
andrew@andrew-media:~/ps3mediaserver-read-only/ps3mediaserver$ java -version
java version "1.6.0_17"
Java(TM) SE Runtime Environment (build 1.6.0_17-b04)
Java HotSpot(TM) Client VM (build 14.3-b01, mixed mode, sharing)


when i run from terminal, it works;

Code: Select all
andrew@andrew-media:~/ps3mediaserver-read-only/ps3mediaserver$ ./PMS.sh
[main] TRACE 12:01:20.569 Starting Java PS3 Media Server v1.20
[main] TRACE 12:01:20.571 by shagrath / 2008-2009
[main] TRACE 12:01:20.571 http://ps3mediaserver.blogspot.com
[main] TRACE 12:01:20.571 http://code.google.com/p/ps3mediaserver
[main] TRACE 12:01:20.572
[main] TRACE 12:01:20.572 Java 1.6.0_17-Sun Microsystems Inc.
[main] TRACE 12:01:20.572 OS Linux i386 2.6.31-14-generic
[main] TRACE 12:01:20.573 Encoding: UTF-8
[main] TRACE 12:01:20.587 Temp folder: /tmp/javaps3media


I apologies in advance if some things are wrong, or my understanding is incorrect, I only started using Ubuntu a few days ago.

source for java: http://henneberke.wordpress.com/2006/10/25/configuring-java-in-ubuntu/
t4it
 
Posts: 1
Joined: Fri Nov 06, 2009 1:18 am

Re: HOWTO: PS3 Media Server on Ubuntu 9.10 karmic koala

Postby homeofpoe » Sat Nov 07, 2009 12:37 am

industrai wrote:First download JDK 6 from Sun. We need this to compile PS3 Media Server. Go to Google JDK 6, and grab the latest JDK from Sun. As of this writing it is JDK 6 Update 16, and the filename I downloaded for 64bit was jdk-6u16-linux-x64.bin
Once the file has finished downloading, in your terminal window navigate to your Downloads

Code: Select all
cd ~/Downloads


and run

Code: Select all
sh ./jdk-6u16-linux-x64.bin


Read the EULA and accept it. Once it finishes the install, we need to set our Java HOME to the jre directory within the JDK we just installed. To do that run:

(replace this directory with the valid directory you just installed JDK to)
Code: Select all
JAVA_HOME=/home/YOUR_UBUNTU_USERNAME/Downloads/jdk1.6.0_16/jre

then export the JAVA_HOME variable so it is available to other applications in this terminal session.
Code: Select all
export JAVA_HOME


It's not really necessary to manually download and compile Java like that. Depending on which version of Java you use (A: Sun, or B: OpenJDK; determinable via "java -version" in a console), you can use the repositories. Far less confusing, and you don't have to worry about any of that JAVA_HOME stuff:

To determine your version:
Code: Select all
$ java -version
java version "1.6.0_0"
OpenJDK Runtime Environment (IcedTea6 1.6.1) (6b16-1.6.1-1ubuntu3)
OpenJDK Client VM (build 14.0-b16, mixed mode, sharing)


A: Sun's Java:
Code: Select all
sudo apt-get install sun-java6-source


B: OpenJDK:
Code: Select all
sudo apt-get install openjdk-6-source
homeofpoe
 
Posts: 3
Joined: Sat Nov 07, 2009 12:31 am

Next

Return to Linux/Unix Support

Who is online

Users browsing this forum: No registered users and 19 guests