[Ffmpeg-devel] Writing a video from char buffer

Alexandre Parent alx
Mon May 30 12:34:36 CEST 2005


Hi all,

I am new subscriber to the mailing list, and I need some wise advises
for writing  a video.
I wrote a writing Class and I would use it like this :

int main ()
{
   unsigned char *buffer;

    writingClass *wc = new writingClass();
    wc->Init(); // AvRegister...
    wc->setConfig(...); // set the width, height, frame_rate, bit_rate, 
codec_type of the output
    wc->OpenTarget("filename.avi"); // using av_write_header()
    for (int i = 0; i < 42; i++)
    {
       buffer = getImageBuffer("toto.tga"); // buffer is a pointer  to 
the image's data (BGRA order)
       wc->addFrame(buffer);            // using av_write_frame
       free(buffer);
    }
    wc->CloseOutput(); // using av_write_trailer()
    return 0;
}

Unfortunately my class seems to work but the output file is unreadable. 
(I try the MPEG4 format)
My problem is that I don't know what minimals structures I must use to 
make my class Working.
Maybe I'm confusing the data to encode with the container, but I'm not 
very aware of these tricks and
would be glad if someone could enlightened me on these points.
Do I have to work on the streams, on the file, on the codec context ???

I tried to be clear but as I don't know how to use correctly the ffmpeg 
lib, maybe it's a mess.

Regards.
-- 
  Alexandre

 





More information about the ffmpeg-devel mailing list