[Ffmpeg-devel] Motion Jpeg to mpeg2

Behrbaum, Jeffrey S jeffrey.s.behrbaum
Tue Aug 9 22:08:48 CEST 2005


Hi all. I'm trying to take a bunch of jpeg's (not jfif's) and put them into an mpeg2 stream My question is how do you do this. I have everything setup but am having trouble figuring out exactly what to do with the images I have. There is a segment of ffmpeg sample code where a dummy frame is being set up, see below (from apiexample.c line 235)  Now, I have a mono color jpeg (see attached if you'd like) and I'm not sure what to do with it before passing it into avcodec_encode_video.  I know that to someone out there this is a trivial problem and one that has probably been solved many times so let me apologize for my ignorance in advance.  However, if someone could help me I would be indebted to you. Even if you know of the line(s) of code that are solving this problem from within the ffmeg itself, I'd really appreciate it.  I've looked but can't seem to nail down what to do.  Thanks in advance to any and all for your help.

Jeff

		// prepare a dummy image
		// Y
		for(int y = 0; y < m_pAV_EncoderContext->height; y++) 
		{
			for(int x = 0; x < m_pAV_EncoderContext->width; x++) 
				m_pAVFrame->data[0][y * m_pAVFrame->linesize[0] + x] = x + y + i * 3;
		}//End outer for loop

		// Cb and Cr
		for(int y = 0; y < m_pAV_EncoderContext->height / 2; y++) 
		{
			for(int x = 0; x < m_pAV_EncoderContext->width / 2; x++) 
			{
				m_pAVFrame->data[1][y * m_pAVFrame->linesize[1] + x] = 128 + y + i * 2;
				m_pAVFrame->data[2][y * m_pAVFrame->linesize[2] + x] = 64 + x + i * 5;
			}//End inner for loop
		}//End outer for loop

		// encode the image
		out_size = avcodec_encode_video(m_pAV_EncoderContext, outputBuf, iOutputBufSize, m_pAVFrame);



 <<img1.jpg>> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: img1.jpg
Type: image/jpeg
Size: 35896 bytes
Desc: img1.jpg
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20050809/796c6838/attachment.jpg>



More information about the ffmpeg-devel mailing list