yunsole
30th January 2006, 18:09
Hello,
I encode an yuv input to a compressed stream by some standard, let's say h.263, avc or mpeg4. This stream only has the head info. defined by the standard, and I would like to wrap it an avi file by using the AVIFILE functions.
My simple procedure is :
1. use AVIFileCreateStream() to create an empty stream associated with an avi file (exp. output.avi) to write.
2. set its format with AVIStreamSetFormat(), the FOURCC is also set in this step.
3. Assume I could handle each frame freely. After encoding a frame with a codec(exp. xvid), the compressed stream is stored in a buffer, lpOutput, and the size of the stream for the current frame is currFrmStreamSize, then I call function
AVIStreamWrite(pOutAvistream, FrmIdx, 1, lpOutput,
currFrmStreamSize, IsKeyFrame, NULL, NULL);
Where, pOutAvistream is the output avi stream created by AVIFileCreateStream(), FrmIdx is the index of the current frame.
My doubt is that whether the AVIStreamWrite() will aslo do compression itself since the microsoft document does not clearly say this function only write the data from lpOutput to pOutAvistream directly.
4. when all frames are coded, call AVIStreamRelease() and AVIFileRelease()
Has anybody done similar things before without only depending on the AVIFILE functions to create an avi file?
Thanks.
I encode an yuv input to a compressed stream by some standard, let's say h.263, avc or mpeg4. This stream only has the head info. defined by the standard, and I would like to wrap it an avi file by using the AVIFILE functions.
My simple procedure is :
1. use AVIFileCreateStream() to create an empty stream associated with an avi file (exp. output.avi) to write.
2. set its format with AVIStreamSetFormat(), the FOURCC is also set in this step.
3. Assume I could handle each frame freely. After encoding a frame with a codec(exp. xvid), the compressed stream is stored in a buffer, lpOutput, and the size of the stream for the current frame is currFrmStreamSize, then I call function
AVIStreamWrite(pOutAvistream, FrmIdx, 1, lpOutput,
currFrmStreamSize, IsKeyFrame, NULL, NULL);
Where, pOutAvistream is the output avi stream created by AVIFileCreateStream(), FrmIdx is the index of the current frame.
My doubt is that whether the AVIStreamWrite() will aslo do compression itself since the microsoft document does not clearly say this function only write the data from lpOutput to pOutAvistream directly.
4. when all frames are coded, call AVIStreamRelease() and AVIFileRelease()
Has anybody done similar things before without only depending on the AVIFILE functions to create an avi file?
Thanks.