PMP VLC Player
==============

version: v.0.0.8
date: 06-25-2006
by: JockyW

Contents
========
1. Changelog
2. What can you do with it?
3. Installation
4. Usage with VLC
5. Usage with PMP Server
6. PMP.INI example
7. Issues and future features
8. Credits
Annex1: Dbox2/Dreambox/TiVo live TV streaming
Annex2: How to stream (internet) video podcasts to PSP
Annex3: How to stream from TV cards to PSP
Annex4: Network connection diagnostic info

1. Changelog
============

v0.0.8 (06-25-06)
1) added DVD and (S)VCD streaming from PC to PSP
2) left trigger in main screen toggles between PMP server and VLC server (initially VLC server)
3) separate entries in pmp.ini for ip and port for VLC and PMP server
4) can only play music in PMP server mode (allows playing music in original format, no transcoding)
5) uses VLC 0.8.5 (!!!!! location of pspfiles.html changed (see ch3) !!!!!!!)
6) uses latest ffmpeg ogg routines, can now use mp3 in ogg container
7) tidied up this readme
8) added network connection diagnostic info (see annex4)

v0.0.7 (06-22-06)
1) first release
2) uses VLC 0.8.4a

2. What can you do with it?
===========================

PMP VLC Player plays mediafiles:

A) from memorystick
	* Videos from PSP/VIDEO
	* Music from PSP/MUSIC

B) from Optixx' PMP Server via WiFi (requires Python)

This is similar to the PMP MOD 2.00 version with network support, but it requires you to manually transcode all your video files to PSP format. I added it this feature for playing music files in native format (.mp3 and .m4a) where there is no need for transcoding. You can toggle between PMP and VLC server by pressing left trigger in the main screen

C) transcoded and streamed from VLC via WiFi (requires VLC 0.8.5)

Now that's really new :)

You can now play mediafiles on your PSP which are stored on your PC, with no need to first manually transcode and copy them to memstick. So if you are a lazy bumb like myself and if your PC runs all the time and you like to watch movies or tv on your PSP this proggie is just what you need. The transcoding is done by VLC in real time (that is if your PC is fast enough. My CPU is a AMD XP2400 with 768MB RAM and runs just fine). The PMP VLC client controls your VLC server: you can open a file for playback, pause, stop and seek (forward, rewind) it. Streaming protocol is http via tcp.

If you have a TV card or any live stream source you can have VLC transcode and stream it to your PSP. I use a Dbox2 digital sat receiver which send the stream to VLC which in turn sends a transcoded stream to my PSP. Atm I'm watching WC Soccer Brasil ag. Japan 1:1  The ball is a bit small but bigger than on my UMTS mobile :)
And beginning with v0.0.8 you can also stream DVD and (S)VCD. Now isn't that nice?

Another advantage is that VLC runs on many platforms (linux, windowz, mac, etc.)

PMP VLC 0.0.8 is actually JiniCho's PMP 0.06 (Nov '05) with jonny's performance improvements. I've added network streaming and VLC control support. Essentially it is a PSP port of Ffmpeg's ffplayer.


3. Installation
===============

1) install VLC 0.8.5 on your PC
Get it from: http://www.videolan.org/vlc/
If you have a older version uninstall it and make sure to delete preferences and cache.

2) On windowz create a shortcut to vlc.exe where target looks like this:
"D:\Program Files\VideoLAN\VLC\vlc.exe" --extraintf=http --sout-transcode-fps 25.0000
(note that your path may be different from mine).
On other platforms make sure that vlc is strated with the parameters:
--extraintf=http --sout-transcode-fps 25.0000

3) !!!!CHANGED!!!! => copy VLC/pspfiles.html to D:\Program Files\VideoLAN\VLC\http\old\admin

4) rename or remove the file .access if it exists in D:\Program Files\VideoLAN\VLC\http\old\admin (it allows for password access control which I currently do not support) 

5) copy the PMP VLC binaries to your PSP (/PSP/GAME/PMPVLC008_JockyW and PMPVLC008_JockyW%)

6) edit pmp.ini and copy it to /PSP/GAME/PMPVLC008_JockyW

==> See below for an example of pmp.ini <==
==> set vlc = 0 if you use pmp_server, and 1 if you use vlc <==


4. Usage with VLC
=================

!! Before you start, make sure that there is at least one file in each of the /PSP/MUSIC and /PSP/VIDEO directories on the memorystick.

1) start VLC with the parameters: --extraintf=http --sout-transcode-fps 25.0000

2) start PMP VLC 0.0.8 on your PSP

3) in the main menu press the right trigger to enable WiFi and network support
   left trigger toggles between PMP server and VLC server (initially VLC server)

4) click the select button and from the media menu select video, music, live stream, dvd stream or (s)vcd stream

5) if you select video or music a directory listing shows mediastick and network files. The latter are shown with the prefix "net:/" (backslashes are shown with some kind of weird character, prolly because the font I use does not have it or whatever. That's just cosmetics which doesn't interest me so much). If you select dvd or (s)vcd make sure you have one in the drive which is indicated in pmp.ini (e.g. d:)

6) during video playback you can use:
square  -> stop playback
cross   -> pause
D-pad R -> forward 10 sec
D-pad L -> rewind 10 sec
D-pad U -> forward 1 min
D-pad D -> rewind 1 min
R-trig	-> forward 5 minutes
L-trig	-> rewind 5 minutes
(Note1: the D-pad and triggers are disabled in livestream mode)
(Note2: with some files seeking/skipping doesn't work)

7) during music playback you can use:
R-trig	-> play next track in directory
L-trig	-> play previous track in directory
square  -> stop playback
cross   -> pause

==> If you play music it is transcoded <==


5. Usage with PMP Server
========================

1) start PMP server
* I've added Optixx' PMP server (pmp_server.py) in the package
* The music path can be edited in a text editor (windows: line 56, linux: line 58, default path is d:\music)

2) start PMP VLC 0.0.8 on your PSP

3) in the main menu press the right trigger to enable WiFi and network support

4) click the select button and from the media menu select music

5) a directory listing shows mediastick and network files. The latter are shown with the prefix "net:/" 

6) during music playback you can use:
R-trig	-> play next track in directory
L-trig	-> play previous track in directory
square  -> stop playback
cross   -> pause


6. PMP.INI example
==================

It consists of 3 sections:
1) [net] for network settings

con: the WiFi profile
vlc_server: ip address of running VLC server (the IP of your PC)
vlc_port: port number of your VLC You can set it to 8080 (same port is used for control) or to any free port on your PC. 
pmp_server: ip address of your PMPserver
pmp_port: port number PMPserver. PMPserver uses 3333 by default but you can change it in the pmp_server.py script.
debug: set it to 1 if you want to debug with psplink

videopath: the path on your PC where your movies are stored
musicpath: the path on your PC where your music is stored
*) Note: only for VLC, the PMPserver directory is hard coded in pmp_server.py

dvd_drive: e.g. in windows d: if that is the dvd drive containing a dvd or (s)vcd (can also be a virtual drive of course, like a daemon tools virtual cd drive), in linux /dev/dvd


2) [transcode] for VLC audio/video transcoding settings

This is a tricky part where you can spend quite some time with :)
For background info on this see:
http://www.videolan.org/streaming/features.html
http://www.videolan.org/doc/streaming-howto/en/streaming-howto-en.html

I recommend these settings as they are most stable and deliver reasonable good quality:
res_horiz = 360;
res_vert = 272;
vid_codec = DIV3;
vid_bitrate = 600;
vid_fps = 25;
aud_codec = mp3;
aud_bitrate = 48;
aud_channels = 2;
container = ogg;

I found that ogg container format works best, followed by asf. The asf demuxer often fails with an assertion.
aud_codec = mp3 with aud_bitrate = 64 can work nice and fluent too, however there is a bug in the ffmpeg ogg demuxer causing a crash after ca. 15-20 minutes.

You should experiment to find your optimal settings. You can probably raise the bitrate a bit and you can try other videocodecs such as mp4v.

I had little success using ts and ps containers.

3) [live] live stream server IP and Port numbers

Note that lines starting with a # are treated as comments

[code]

# Net Io Config
[net]
con	    	= 2;   
vlc_server 	= 192.168.1.13;
vlc_port	= 8080;
pmp_server 	= 192.168.1.13;
pmp_port	= 3333;
debug	  	= 0;
videopath	= d:\Movies\;
musicpath	= d:\Music\;
dvd_drive	= g:

# VLC transcoding settings
[transcode]
res_horiz = 360;
res_vert = 272;

vid_codec = DIV3;
#vid_codec = mp1v;
#vid_codec = mp2v;
#vid_codec = mp4v;
#vid_codec = DIV1;
#vid_codec = DIV2;
#vid_codec = h263;
#vid_codec = h264;
#vid_codec = WMV1;
#vid_codec = WMV2;
#vid_codec = mjpg;
#vid_codec = theo;

vid_bitrate = 600;
vid_fps = 25;

#aud_codec = mpga;
#aud_codec = mp2a;
aud_codec = mp3;
#aud_codec = mp4a;
#aud_codec = a52;
#aud_codec = vorb;
#aud_codec = flac;
#aud_codec = spx;
#aud_codec = s16l;
#aud_codec = fl32;

aud_bitrate = 48;
aud_channels = 2;

container = ogg;
#container = ts;
#container = ps;
#container = mpeg1;
#container = mp4;
#container = mov;
#container = wav;
#container = raw;
#container = asf;
#container = asfh;
#container = mpjpeg;


# live stream server
[live]
liveserver	= 192.168.1.13;
liveport	= 1234;

[/code]


7. Issues and future features
=============================

- there are still many stability and performance issues. Usually the first video starts and stops immediately, the second time it usually continues to play well. I've added an automatic restart mechanism to cope with this, but it's not bullet proof.
- automatic detection of videoformat and compliant setting of transcoding resolution
- with jonny's GU color space conversion I can probably gain a few frames per second.
- use latest ffmpeg
- it would be cool if VLC would support jonny's pmp container ;) (can be done since VLC is open source)
- nicer gui (Raphael?)
- resolve start button bug
- integrate media menu in main screen
- changedir support
- vlc and net dir buffer issue (there's crap at the end)
- x264 video + mp3 audio decoding using PSP hardware
- the next version will definitely be better :)


8. Credits
==========

* JiniCho is the genius who started PMP player based on ffmpeg and ffplay.
* jonny is the genius who created the PMP MOD player with many performance enhancements
* all other devs of ps2dev.org
* all ffmpeg devs (amazing, educating and incredible fun)
* all devs of tuxbox.org (a community dedicated to dbox2 DVB receivers)
* and to all I forgot ...


Annex1: Dbox2/Dreambox/TiVo live TV streaming
=============================================

Here are instructions for streaming from Dbox2/Dreambox to PSP via VLC.
(Note TiVo boxes should work similar with variant 1. Anyone with such a box please give feedback)

Variant 1)
----------
No need for Neutrino GUI and/or Neutrino TV
I tested this with RTL on digital Astra 19.2E and it worked fine.

1) zap to RTL channel on Dbox2/Dreambox
2) start VLC on PC
3) File - Open Network Stream ...
4) in Open textbox paste http://192.168.1.250:31339/0,002C,00A3,0068,006A,0069  (IP you should be your Dreambox)
5) check 'Stream output' and click Settings button
6) in destination target paste the following line (*without* the [code] and /code] tags but *with* the starting ':'
[code]
:sout=#transcode{vcodec=DIV3,vb=600,width=360,height=272,fps=25,acodec=mp3,ab=48,channels=2}:duplicate{dst=std{access=http,mux=ogg,url=0.0.0.0:1234}}
[/code]
Note: instead of vb=600, fps=25, acodec=mp3 also try with vb=700, fps=20, acodec=vorb
7) no further settings necessary, just click OK twice
8) start PMP VLC on PSP
9) select Live Stream and enjoy RTL live on your PSP, of course this will work for all other channels too 


Variant 2)
----------

I'm using the Neutrino GUI on my Dbox2 for which there is this cool app called NeutrinoTV. 

Check it out here: 
http://forum.tuxbox.org/forum/viewtopic.php?t=41590
(I hope you can read german too :))

So if your Dreambox runs Neutrino then you only need to install NeutrinoTV (which can stream radiochannels as well), configure it with your Dreambox IP and run it. 

NeutrinoTV picks up the stream from your Dreambox and acts as the VLC server for the PSP. In my distribution you find a directory VLC in which there are 3 streaming profiles for NeutrinoTV: 
EnablePSPStreamingServer-asf-mp3.nvo 
EnablePSPStreamingServer-ogg-mp3.nvo 
EnablePSPStreamingServer-ogg-vorbis.nvo 

On the PSP you'd select play Live Stream and in your pmp.ini in the live section the port number should be set to 1234 (this corresponds with the port number in the 3 profiles). Of course you change that. 

I recommend the latter profile for near perfect streaming comfort ! 
Works great for me.

PS: even if your Dbox2 or Dreambox has a VLC plugin it can not be used without NeutrinoTV.
Your box simply does not have enough horsepowers to do the on-the-fly transcoding !


Annex2: How to stream (internet) video podcasts to PSP
======================================================

1) start VLC on PC
2) File - Open Network Stream ...
3) in Open textbox paste the url of the video stream, e.g.:
http://i.a.cnn.net/cnn/services/podcasting/nitn/video/2006/06/22/nitn.06.22.affl.m4v
4) check 'Stream output' and click Settings button
5) in destination target paste the following line:
[code]
:sout=#transcode{vcodec=DIV3,vb=600,width=360,height=272,fps=25,acodec=mp3,ab=48,channels=2}:duplicate{dst=std{access=http,mux=ogg,url=0.0.0.0:1234}}
[/code]
Note: instead of vb=600, fps=25, acodec=mp3 also try with vb=700, fps=20, acodec=vorb
6) no further settings necessary, just click OK twice
7) start PMP VLC on PSP
8) select Live Stream and enjoy a transcoded stream on your PSP


Annex3: How to stream from TV cards to PSP
==========================================

1) start VLC on PC
2) File - Open Capture Device ...
3) enter capturing card details in the dialog
4) check 'Stream output' and click Settings button
5) in destination target paste the following line:
[code]
:sout=#transcode{vcodec=DIV3,vb=600,width=360,height=272,fps=25,acodec=mp3,ab=48,channels=2}:duplicate{dst=std{access=http,mux=ogg,url=0.0.0.0:1234}}
[/code]
Note: instead of vb=600, fps=25, acodec=mp3 also try with vb=700, fps=20, acodec=vorb
6) no further settings necessary, just click OK twice
7) start PMP VLC on PSP
8) select Live Stream and enjoy a transcoded stream from your capture or TV card on your PSP


Annex4: Network connection diagnostic info
==========================================

Start the PMP VLC and after clicking the right shoulder button to enable Wifi and network support click select - Music. 
You should see shortly this: 

========================================================================
Connecting to Access Point...
connection state 0 of 4 
connection state 2 of 4 
connection state 4 of 4
IP Address = 192.168.1.39 (that's my ip address, you should see yours)
Connection is okay if returncode is 0 => returncode = 0
========================================================================

All should be well if that is the case.
