capturing video

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
Ghoti
Posts: 288
Joined: Sat Dec 31, 2005 11:06 pm

capturing video

Post by Ghoti »

Hi folks,

I was wondering how i can record ingame footage. I have heard of a plugin for devhook but since i myself have no devhook running i was hoping that there was also an other way. I have dark alex's custom firmware running though.

hope someone can fill me in,

grewets ghoti
Bytrix
Posts: 72
Joined: Wed Sep 14, 2005 7:26 pm
Location: England

Post by Bytrix »

Look on dl.qj.net for SVCapture 0.5.

It can capture screenshots and GIF 'videos'.
Ghoti
Posts: 288
Joined: Sat Dec 31, 2005 11:06 pm

Post by Ghoti »

hmmm i tried to record homebrew but that did not work :S i have however made a movie of my xmb but i want to make footage of my game.
Bytrix
Posts: 72
Joined: Wed Sep 14, 2005 7:26 pm
Location: England

Post by Bytrix »

Did you create the file called game.txt and put the path to SVcapture.. then boot into recovery mode of OE and enable the plugin for 'in-game' use ?
Ghoti
Posts: 288
Joined: Sat Dec 31, 2005 11:06 pm

Post by Ghoti »

i have created the game.txt file in that i have entered this line:
ms0:/seplugins/capture.prx
howeve i use the 3.02 firmware of dark alex and not the 2.71c.

i Have not put the path to svcapture? how do i do that?

i have enabled the plugin both for vhs and for game and i can record and take screenshots in the xmb but in the homebrew it did not work :(
Bytrix
Posts: 72
Joined: Wed Sep 14, 2005 7:26 pm
Location: England

Post by Bytrix »

It could be that the homebrew you're using is overriding the button calls for SVCapture. Can't see any reason why it wouldn't work.
Ghoti
Posts: 288
Joined: Sat Dec 31, 2005 11:06 pm

Post by Ghoti »

hmm yes that could be i have made the homebrew myself but it does not catch the triggers buttons or the music note button... well to bad :(
Bytrix
Posts: 72
Joined: Wed Sep 14, 2005 7:26 pm
Location: England

Post by Bytrix »

Well if it's your own homebrew you could quite easily add a screenshot function to it. I have in all my homebrew directly after the rendering stage, if a screenshot has been initiated it writes the buffer to a file..
Ghoti
Posts: 288
Joined: Sat Dec 31, 2005 11:06 pm

Post by Ghoti »

Yes i guess i will do that but my screen shot code is very slow...

Code: Select all

// -----------------------------------------
//
// GameTakeScreenShot
//
// -----------------------------------------
	int GameTakeScreenShot(void){

		saveImage("ms0:/ss.png", getVramDisplayBuffer(), 480, 272, PSP_LINE_SIZE, 0);

		return 0;
	}
and the saveimage code (from the graphics.c file form the yelarb tutorials.)

Code: Select all

void saveImage(const char* filename, Color* data, int width, int height, int lineSize, int saveAlpha)
{
	png_structp png_ptr;
	png_infop info_ptr;
	FILE* fp;
	int i, x, y;
	u8* line;
	
	if ((fp = fopen(filename, "wb")) == NULL) return;
	png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
	if (!png_ptr) return;
	info_ptr = png_create_info_struct(png_ptr);
	if (!info_ptr) {
		png_destroy_write_struct(&png_ptr, (png_infopp)NULL);
		return;
	}
	png_init_io(png_ptr, fp);
	png_set_IHDR(png_ptr, info_ptr, width, height, 8,
		saveAlpha ? PNG_COLOR_TYPE_RGBA : PNG_COLOR_TYPE_RGB,
		PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
	png_write_info(png_ptr, info_ptr);
	line = (u8*) malloc(width * (saveAlpha ? 4 : 3));
	for &#40;y = 0; y < height; y++&#41; &#123;
		for &#40;i = 0, x = 0; x < width; x++&#41; &#123;
			Color color = data&#91;x + y * lineSize&#93;;
			u8 r = color & 0xff; 
			u8 g = &#40;color >> 8&#41; & 0xff;
			u8 b = &#40;color >> 16&#41; & 0xff;
			u8 a = saveAlpha ? &#40;color >> 24&#41; & 0xff &#58; 0xff;
			line&#91;i++&#93; = r;
			line&#91;i++&#93; = g;
			line&#91;i++&#93; = b;
			if &#40;saveAlpha&#41; line&#91;i++&#93; = a;
		&#125;
		png_write_row&#40;png_ptr, line&#41;;
	&#125;
	free&#40;line&#41;;
	png_write_end&#40;png_ptr, info_ptr&#41;;
	png_destroy_write_struct&#40;&png_ptr, &#40;png_infopp&#41;NULL&#41;;
	fclose&#40;fp&#41;;
&#125;
Bytrix
Posts: 72
Joined: Wed Sep 14, 2005 7:26 pm
Location: England

Post by Bytrix »

I'm not sure how much it'll affect the speed but I save my screenshots basically as a raw dump of the screen in BMP/RAW format. It's the fastest way I've seen to do it (although does mean there is more data to write and screenshot sizes are larger.

SVCapture by default records at half screen resolution I think. Currently I don't think there is a real way to capture full screen video.

So far All I've done is screenshots in my apps, I've not implemented video but by reducing the size (by skipping every other pixel, then skipping every other row) you should be able to get decent speed video. (I know it's not the best method of interpolation just skipping pixels, but properly resampling the image down would probably take longer than it does just to capture the full screen image.
Post Reply