Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AVI problems...

Status
Not open for further replies.

XanderKal

Programmer
Aug 26, 2002
6
FR
Hi !

I'm trying to do a small app to reverse avi (in time domain) and save a new avi like this.

In my first attempt, I use AVIFileOpen() function then AVIFileGetStream() to open a video stream, AVIStreamInfo() to get stream information, I create a new stream with same information with AVIFileCreateStream(), then i use this peace of code to read/write frames :

// read input file frame per frame and write output file
unsigned int i;
for (i=0; i<m_AviStreamInfo.dwLength; i++)
{
long StSize;
result = AVIStreamRead(*pAviStream,m_AviStreamInfo.dwLength-i-1,1,NULL,0,&StSize,NULL);
char * StBuffer = new char[StSize];
result = AVIStreamRead(*pAviStream,m_AviStreamInfo.dwLength-i-1,1,StBuffer,StSize,&StSize,NULL);
if (result !=0)
{
MessageBox(&quot;Error while reading stream&quot;);
delete StBuffer;
break;
}

result = AVIStreamWrite(*pOutputAviStream,i,1,StBuffer,StSize,0,NULL,&StSize);
if (result !=0)
{
MessageBox(&quot;Error while writing stream&quot;);
delete StBuffer;
break;
}

delete StBuffer;
m_Progress.SetPos(i+1);
Sleep(0);
}

BUT this does not work as i would because of the compression of the avi : Depending on the codec used, it is good or not.

So i would like to decompress frames and then to recompress them in the same format but i don't really know how to do it...

Do i need to use AVIStreamGetFrame() and then compress the frame, or do i need to open a decompressor then a compressor with ILocate() or ICOpen() and then do the decompression / compression process ?...

I need help on this point (if anybody has souce code it would be great ;-)) )

if anybody can help me

thanks a lot.

xander
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top