Pvf(PspVideoFormat) Encoder/Playback library.
Pvf(PspVideoFormat) Encoder/Playback library.
Hey, hope you don't mind me posting this here instead of the release forum(Which is like tumbleweed city atm) as most other people release there psp libs here. :)
I needed video for my app, and wasn't too keen on porting a complex library from windows, squashing bugs etc so I decided to write my own, so this was born. Pvf. It includes a windows based command line encoder which converts avi to pvf and it includes a psp C++ based(uses classes so no c I don't think) playback library.
http://www.savefile.com/files/9354107 <Encoder (6.7mb. My god, it's full of dlls! Windows only - Ask for source if you wish to port )
Instructions: Simply drag and drop your windows avi file over the app and it will produce the pvf equilivent for you, informing you of it's progress.
http://www.savefile.com/files/5185915 < PvfLib (NOTE:Tested on 1.5firmware only. I cannot be sure it works on older/new revisions)
http://www.savefile.com/files/3037812 < Psp xxploited demo for 1.5 firmware.
The playback library generates a _frameRgb pointer for each frame which is in pspGL format. (I.e 3 bytes, rgb, 0-255 each )
I've tested it within my 3d engine and it playsback perfectly and pretty fast.
The library uses zlib for both compression and decompression, although you only require it to be installed in your psp environment. the pc side is an exe so not required in cyngwin.
I needed video for my app, and wasn't too keen on porting a complex library from windows, squashing bugs etc so I decided to write my own, so this was born. Pvf. It includes a windows based command line encoder which converts avi to pvf and it includes a psp C++ based(uses classes so no c I don't think) playback library.
http://www.savefile.com/files/9354107 <Encoder (6.7mb. My god, it's full of dlls! Windows only - Ask for source if you wish to port )
Instructions: Simply drag and drop your windows avi file over the app and it will produce the pvf equilivent for you, informing you of it's progress.
http://www.savefile.com/files/5185915 < PvfLib (NOTE:Tested on 1.5firmware only. I cannot be sure it works on older/new revisions)
http://www.savefile.com/files/3037812 < Psp xxploited demo for 1.5 firmware.
The playback library generates a _frameRgb pointer for each frame which is in pspGL format. (I.e 3 bytes, rgb, 0-255 each )
I've tested it within my 3d engine and it playsback perfectly and pretty fast.
The library uses zlib for both compression and decompression, although you only require it to be installed in your psp environment. the pc side is an exe so not required in cyngwin.
Would someone please be kind enougth to explain how I install and use this...? I'm new to making homebrew on 1.5 but have cygwin and the PSPDEV setup and working...
I'm porting my Pimp My Garage web tool to work on the PSP directly and have a lot of it done... I just need to be able to play video media at certain points...
A short tutorial would be excellent and help me a lot...
Thanks
ADePSP
Creator of CheatSync and Pimp My Garage for the CheatDevice by edisoncarter
http://www.cheatsync.net
I'm porting my Pimp My Garage web tool to work on the PSP directly and have a lot of it done... I just need to be able to play video media at certain points...
A short tutorial would be excellent and help me a lot...
Thanks
ADePSP
Creator of CheatSync and Pimp My Garage for the CheatDevice by edisoncarter
http://www.cheatsync.net
There is no installation as such, I never made it into a lib. (No real reason why, just didn't)
So basically, just open up the source/example and compile it, or a much better idea would be to cut and paste it into your engine, it's a really short piece of code overall so as long as you've zlib installed it should work out of the box.
Let me know if you run into any problems, and I'll try to explain it better.
So basically, just open up the source/example and compile it, or a much better idea would be to cut and paste it into your engine, it's a really short piece of code overall so as long as you've zlib installed it should work out of the box.
Let me know if you run into any problems, and I'll try to explain it better.
Thanks i'll give it a go (after this ToolChain installs "just rebuilt PC and god this takes time)"... I probably will need more help but thanks a lot... I'll see if I can work it out...Kojima wrote:There is no installation as such, I never made it into a lib. (No real reason why, just didn't)
So basically, just open up the source/example and compile it, or a much better idea would be to cut and paste it into your engine, it's a really short piece of code overall so as long as you've zlib installed it should work out of the box.
Let me know if you run into any problems, and I'll try to explain it better.
ADe
OK, one big problem... Where is this example...? The links in your first post are for the encoder util, a single file called Pvflib.cc and a compiled demo of the code in action...Kojima wrote:No problem.
Found a serious bug in the encoder, seems I left in some hard-coded stuff that basically overides the input arguments and always loads the avi called "Face2.avi"
so if you've d/l and ran into any problems, it's probably that. I'll release a updated version when I'm not so tired.
Am I missing something...?
ADe
I see... Any chance of an example (very basic) project that does that with instructions on how to install whatever renderer I may need...?Kojima wrote:No you're not, the pvf lib loads the test pvf and grabs each frame, it's down to you to write a renderer.
Sorry to be such a n00b but it's hard not to be when you are learning something... :D
Thanks again,
ADe
I've wrote a new codec, which results in 10x smaller files than pvf. it still uses zlib, but it's got a much fanicer encoder/format. this one has cell and frame indexing allowing real time catching of cells for massive speed increases.
Will release with media player before I go to bed tonight, so not long.
Will release with media player before I go to bed tonight, so not long.
If you see two images, that' just I wasn't sure if it was working or just displaing my cache so I played it safe.
that's pva media viewer, using Raptor's 2d and gui engines. The video display using canvas which have raw surfaces with sync abilities. (Internally they are textures)
Just putting together a file including the new encoder.
I started on a simple streaming one, then we got PiMP Streamer!
I went from
RGB32->swizzled RGB->YUV->YV12->LZO
That got me down to 2Mbits. Still too much to stream, but getting there.
Other things I mean to try
Adding a quantisation to UV and then RLE before LZO compression.
And to get to MPG1 style compression you need DCT and motion compensation.
Jim
I went from
RGB32->swizzled RGB->YUV->YV12->LZO
That got me down to 2Mbits. Still too much to stream, but getting there.
Other things I mean to try
Adding a quantisation to UV and then RLE before LZO compression.
And to get to MPG1 style compression you need DCT and motion compensation.
Jim
If you do the codec, I'll do the media player using raptor :)Raphael wrote:Seeing this really makes me want to jump into making my own codec with some of my h264 knowledge I gathered some time ago and on the way gaining some experience with VFPU (it is really very well suited for codec stuff) :) Keep it up, this has potential.
I would like to try dct and so on but my encoder language (Blitzmax) has no inline asm or anything to really speed up the encoding process.
pva encoding compared of pvf is painfully slow.
Kojima, I like pvflib and im thinking bout integreating it to luaplayer so that i can use it for my mmo game that im working on. Im just wondering if there is a way to have it work with yeldarb's c\c++ graphics thing cus im not that keen with pspGL. I've been kinda studying the src code of the pvflib and im sorta having some doubts that i can integrate it with luaplayer.
You said that you'd be releasing an open source pvf media player with video render so that ppl can learn from it, yet, i have not yet seen it. I really want to see how it works. It's been a month since you said that, when are you going to release it?
You said that you'd be releasing an open source pvf media player with video render so that ppl can learn from it, yet, i have not yet seen it. I really want to see how it works. It's been a month since you said that, when are you going to release it?
"Every team needs an idealistic person (whether they are a noob or a pro), my team doesn't have one cus im the idealistic founder." - me
No I'm afraid I won't be releasing it.
I'm happy for you include it luaplayer, but I don't know much about that guy's 2d library, never seen it before or even know where to get it.(I've only used luaplayer briefly to try out some demos)
But as long as it can display a raw buffer in rgb format (1 byte = one component in the range of 0 to 255) then it can work.
but seriously I suggest grabbing raptor alpha 3 and using the new pva video format. its faster, better compressed etc. I can hook you up with the pva encoder if you like.
Here's the source though.
It uses raptor for the gui/display.
[/code]
I'm happy for you include it luaplayer, but I don't know much about that guy's 2d library, never seen it before or even know where to get it.(I've only used luaplayer briefly to try out some demos)
But as long as it can display a raw buffer in rgb format (1 byte = one component in the range of 0 to 255) then it can work.
but seriously I suggest grabbing raptor alpha 3 and using the new pva video format. its faster, better compressed etc. I can hook you up with the pva encoder if you like.
Here's the source though.
Code: Select all
const int m_play = 1,m_rew =2,m_ff = 3,m_pause = 4,m_stop = 5;
int main(int argc, char **argv)
{
pspDebugScreenInit();
printf("Test.\n");
InitRaptor();
Joypad *joy = new Joypad;
//printf("C:/Dir/OtherDir/test.bmp\n");
//char * buf = (char *)malloc(1);
//buf[0] = 92;
//printf( "C:\Dir\OtherDir\Test.bmp\n");
//printf("::\n");
//Window * tst = new Window;
// Pvf *video = new Pvf("tst.pvf");
SetDefaultStyle( new GradientStyle );
Display *sys = new Display(argc,argv);
Pen *pen = new Pen;
/*
Prefab *prefab = new Prefab;
Camera *vcam = Factory->ProduceCamera();
Entity *box = prefab->CreateCube( 10 );
vcam->Position(0,20,-40);
Renderer->_ActiveCam = vcam;
box->Position(0,0,0);
box->Rotate(0,0,0);
vcam->PointAt(0,0,0);
float bx,by;
bx=0;
by=0;
float cp=0,cy=0;
*/
/*
sys->Draw2D();
Cursor *curs = new Cursor( new Texture("NeHe.bmp",BMP) );
Gui *mgui = new Gui( curs,joy );
mgui->SetBackground( new Texture("back1.bmp",BMP) );
Body *view = new Body( 40,20,400,170,"Output");
Canvas *vsurf = new Canvas( 5,5,390,160,256,256 );
view->Attach( vsurf );
Body *cpanel = new Body(0,200,478,70,"Controls");
Button *ok = new Button(20,20,80,30,"OK");
ok->SetBounds( 0,20,458,20 );
ok->SetScroll( true,false );
//Label *lab = new Label(,20,"Playback");
SliderH *slide = new SliderH( 5,2,458,20,"Z");
cpanel->Attach( slide );
slide->SetRange( 10 );
slide->SetValue( 10 );
Texture *rewimg = new Texture("rewind.bmp",BMP);
Texture *fasimg = new Texture("fastf.bmp",BMP);
Texture *pauseimg = new Texture("pause.bmp",BMP);
Texture *playimg = new Texture("play.bmp",BMP);
Texture *stopimg = new Texture("stop.bmp",BMP);
Label *info = new Label( 320,5,"PVA MediaPlay");
Label *file2 = new Label( 320,25,"Face2.PVA");
Button *rewind = new Button( 5,30,40,20,"" );
rewind->SetImage( rewimg );
Button *play = new Button( 48,30,40,20,"" );
play->SetImage( playimg );
Button *fastforward = new Button(91,30,40,20,"" );
fastforward->SetImage( fasimg );
Button *pause = new Button( 134,30,40,20,"" );
pause->SetImage( pauseimg );
Button *stop = new Button( 177,30,40,20,"" );
stop->SetImage( stopimg );
cpanel->Attach( rewind );
cpanel->Attach( play );
cpanel->Attach( fastforward );
cpanel->Attach( pause );
cpanel->Attach( stop );
cpanel->Attach( info );
cpanel->Attach( file2 );
mgui->AttachGadget( cpanel );
mgui->AttachGadget( view );
Font *fnt = new Font("fnt1.bmp",32,32);
FontRenderer->SetActive( fnt );
FontRenderer->SetColor(1,1,1);
// GLuint vidtex;
//glGenTextures(1, &vidtex);
// glBindTexture(GL_TEXTURE_2D,vidtex); // 2d texture (x and y size)
// glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
// glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
//glTexImage2D(GL_TEXTURE_2D, 0, 3, 256,256, 0, GL_RGB, GL_UNSIGNED_BYTE, video->_framergb);
// glBindTexture(GL_TEXTURE_2D,0);
Pva *video = new Pva("face2.pvf");
//file->SetText("Face2.pvf");
slide->SetRange( video->_numframes );
int butstate = 0;
int in=false;
SoundEngine *sfx = new SoundEngine;
Sound *snd = new Sound("ms0:/sound.wav");
int ps =0;
*/
Entity *ent = LoadB3D( (const char *)"level.b3d",NULL );
if(ent==NULL)
{
Logger->Log("Loadb3d returned null entity.\n");
}
else
{
Logger->Log("Loadb3d returned valid entity.\n");
}
int mode;
mode = m_play;
while(1)
{
switch( mode )
{
case m_play:
video->NextFrame();
break;
case m_ff:
video->_frameindex+=4;
if( video->_frameindex>(video->_numframes-1) )
{
video->_frameindex=0;
}
video->SetFrame( video->_frameindex );
break;
case m_rew:
video->_frameindex -= 4;
if( video->_frameindex<0 )
{
video->_frameindex=(video->_numframes-1);
}
video->SetFrame( video->_frameindex );
break;
}
slide->SetValue( video->_frameindex );
vsurf->SetRawAndSync( video->_framergb,false );
//vcam->Rotate( vcam->Pitch(),vcam->Yaw(),vcam->Roll() );
joy->Update();
if( (joy->_triangle == true) )
{
if( ps == false )
{
snd->Play();
ps = true;
}
}
else
{
ps=false;
}
//sfx->Update();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer
//vcam->Move(0,0,0);
// vcam->Other(joy->_x,0,joy->_y);
glLoadIdentity();
//glEnable(GL_TEXTURE_2D);
//glBindTexture(GL_TEXTURE_2D,vidtex);
// pen->Rect(0,0,480,272);
//video->NextFrame();
//glTexImage2D(GL_TEXTURE_2D, 0, 3, 256,256, 0, GL_RGB, GL_UNSIGNED_BYTE, video->_framergb);
glDisable(GL_TEXTURE_2D);
glColor4f(1,1,1,1);
pen->Rect(20,20,80,20);
Blend_Mask();
mgui->Update();
mgui->Render();
//glEnable(GL_TEXTURE_2D);
//fnt->_tex->Bind();
//pen->Rect(0,0,480,272);
//FontRenderer->RenderText(0,0,"Gui Test Alpha 1");
int ec = mgui->CountEvents();
for(int i=0;i<ec;i++)
{
Event *e = mgui->GetEvent( i );
switch(e->_id)
{
case Mouse_Enter:
//snd->Play();
break;
case Mouse_Leave:
break;
case Gadget_Action:
if( e->_from == play )
{
mode = m_play;
}
if( e->_from == rewind )
{
mode = m_rew;
}
if( e->_from == fastforward )
{
mode = m_ff;
}
if( e->_from == pause )
{
mode = m_pause;
}
if( e->_from == stop )
{
mode = m_stop;
video->_frameindex = 0;
}
break;
}
}
switch(e->_id)
{
case Mouse_Enter:
break;
case Mouse_Leave:
break;
case Gadget_Action:
break;
}
mgui->ClearEvents();
//Renderer->RenderScene();
// sys->Draw2D();
if(joy->_select==1)
{
sceKernelExitGame();
}
if( joy->_rtrigger )
{
screenshot("mplay");
}
glutSwapBuffers();
}
return (0);
}
[/code]