Recording and streaming emu frames

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

User avatar
Anes
Posts: 621
Joined: Tue Dec 21, 2004 8:35 pm
Location: Mendoza, Argentina

Re: Recording and streaming emu frames

Post by Anes »

what is a "scanline stride"??

What i have is all the pixels retriving a pointer to my D3d9 texture, wich acttually contain the RGB info (from botton to up) wich i actually invert the image by code.
ANes
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Recording and streaming emu frames

Post by tepples »

Anes wrote:what is a "scanline stride"??
I assume the number of bytes between the start of one scanline and the start of the next.
rockcarry
Posts: 21
Joined: Tue Oct 14, 2014 7:30 am

Re: Recording and streaming emu frames

Post by rockcarry »

Anes wrote:I solved it... thanks
what's the problem, and how do you fix it ?
rockcarry
Posts: 21
Joined: Tue Oct 14, 2014 7:30 am

Re: Recording and streaming emu frames

Post by rockcarry »

tepples wrote:
Anes wrote:what is a "scanline stride"??
I assume the number of bytes between the start of one scanline and the start of the next.
Yes, you are right.
User avatar
Anes
Posts: 621
Joined: Tue Dec 21, 2004 8:35 pm
Location: Mendoza, Argentina

Re: Recording and streaming emu frames

Post by Anes »

rockcarry wrote:
Anes wrote:I solved it... thanks
what's the problem, and how do you fix it ?
No, no it was a noob thing from my part. I realized that i had the .def empty.
Then what i did was to add to the .def file:

Code: Select all

EXPORTS
ffencoder_audio
ffencoder_free
ffencoder_init
ffencoder_video
and made:

Code: Select all

lib /def:ffencoder.def /OUT:ffencoder.lib
from the Visual Studio 2010 command prompt.

and then inside the code:

Code: Select all

extern "C" {
#include <ffencoder.h>
}
having the path of "ffencoder.h" in my lib path.

And solved it :lol:
ANes
User avatar
Anes
Posts: 621
Joined: Tue Dec 21, 2004 8:35 pm
Location: Mendoza, Argentina

Re: Recording and streaming emu frames

Post by Anes »

So the encoder works by "scanline"??
ANes
User avatar
Anes
Posts: 621
Joined: Tue Dec 21, 2004 8:35 pm
Location: Mendoza, Argentina

Re: Recording and streaming emu frames

Post by Anes »

I'll be honest, i don't know how to encode the video.
If i have a ptr to all the ARGB pixels of frame how do i do?
thanks.
ANes
rockcarry
Posts: 21
Joined: Tue Oct 14, 2014 7:30 am

Re: Recording and streaming emu frames

Post by rockcarry »

Anes wrote:I'll be honest, i don't know how to encode the video.
If i have a ptr to all the ARGB pixels of frame how do i do?
thanks.

Code: Select all

BYTE  vbuf[256 * 240 * 4];
void *vdata   [8] = { vbuf };
int   linesize[8] = { 256 * 4 };
ffencoder_video(encoder, vdata, linesize);
vbuf stored the 32bit ARGB data, then vdata[0] = vbuf, linesize[0] = 256 * 4
nIghtorius
Posts: 48
Joined: Tue Apr 29, 2014 1:31 pm

Re: Recording and streaming emu frames

Post by nIghtorius »

rockcarry wrote:
Anes wrote:I'll be honest, i don't know how to encode the video.
If i have a ptr to all the ARGB pixels of frame how do i do?
thanks.

Code: Select all

BYTE  vbuf[256 * 240 * 4];
void *vdata   [8] = { vbuf };
int   linesize[8] = { 256 * 4 };
ffencoder_video(encoder, vdata, linesize);
vbuf stored the 32bit ARGB data, then vdata[0] = vbuf, linesize[0] = 256 * 4
Why use arrays? (vdata[8], linesize[8])

why not just

void* vdata
int* linesize

or

int linesize =256 * 4;
ffencoder_video (encoder, &vbuf, &linesize);

why the arrays of 8 elements?
rockcarry
Posts: 21
Joined: Tue Oct 14, 2014 7:30 am

Re: Recording and streaming emu frames

Post by rockcarry »

ffmpeg using many many different pixel and audio formats, some format is using multi-paneled or multi-channel data.
User avatar
Anes
Posts: 621
Joined: Tue Dec 21, 2004 8:35 pm
Location: Mendoza, Argentina

Re: Recording and streaming emu frames

Post by Anes »

rockcarry wrote:
Anes wrote:I'll be honest, i don't know how to encode the video.
If i have a ptr to all the ARGB pixels of frame how do i do?
thanks.

Code: Select all

BYTE  vbuf[256 * 240 * 4];
void *vdata   [8] = { vbuf };
int   linesize[8] = { 256 * 4 };
ffencoder_video(encoder, vdata, linesize);
vbuf stored the 32bit ARGB data, then vdata[0] = vbuf, linesize[0] = 256 * 4
Damn!! my video only shows green colour with some garbage. Could it be a codec problem? i mean i have "k lite codec pack" installed.
ANes
User avatar
Anes
Posts: 621
Joined: Tue Dec 21, 2004 8:35 pm
Location: Mendoza, Argentina

Re: Recording and streaming emu frames

Post by Anes »

wtf!!! i tried a lot of configurations and still canno't acchive a good .mp4 file...
ANes
User avatar
Anes
Posts: 621
Joined: Tue Dec 21, 2004 8:35 pm
Location: Mendoza, Argentina

Re: Recording and streaming emu frames

Post by Anes »

What i fool i was.. it was "pixel format", anyway i the emu turns very slow as it encode the video. it's my emu performance thing.
ANes
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Recording and streaming emu frames

Post by tepples »

That's another reason for encoding in a separate process: it lets you use all cores of your multi-core CPU.
User avatar
Anes
Posts: 621
Joined: Tue Dec 21, 2004 8:35 pm
Location: Mendoza, Argentina

Re: Recording and streaming emu frames

Post by Anes »

Is it worth to try to encode in a different thread?
I made the following: i created a thread like this:

Code: Select all

DWORD WINAPI ThreadProc(
  _In_  LPVOID lpParameter
)
{
	for (;;)
	{
		if (video_record)
		{
			data[0]    = pixels;
			video_record = 0;
			ffencoder_video(ffhandle, data, linesize);
			//Sleep(1000);
		}
	}
}
so at the end of the frame i set "video_record" to "1".

The emu run fast, but when i play the video runs too fast, i don't know why.
ANes
Post Reply