[Libav-user] A very mysterious question about FFMpeg encoding.

Denis info at denisgottardello.it
Wed Sep 21 21:09:43 CEST 2011

In order to encode a sequence of images to a file I have written a function that works very well. I can produce a h264, theora, mpeg4 
and webm files.
With this row:

if (avio_open(&pFormatCtx->pb, "b.mp4", AVIO_FLAG_WRITE)< 0) ...

I decide the name of the output file (in this case is "b.mp4"). If I modify the row in this mode:

if (avio_open(&pFormatCtx->pb, "http://localhost:3000", AVIO_FLAG_WRITE)< 0) ...

automatically the output is sent to that web server. The problem is that I want to send the output at a buffer that I can read.
I have tried in this mode:

if (avio_open(&pFormatCtx->pb, NULL, AVIO_FLAG_WRITE)< 0) ...
pFormatCtx->pb->opaque= this;
pFormatCtx->pb->write_packet= WritePacket; // Callback
pFormatCtx->pb->write_flag= AVIO_FLAG_WRITE;

but does not work. The file is not correct. mplayers can play it only in mpegts but not with the others codecs.

The question is: Wich is the right way to encode in a buffer and not in a file? I am surfing on the web from many weeks without find the 
solution. I am studing the source of ffmpeg and ffserver but nothing. Can you help me?

Skype: mrdebug
Videosurveillance and home automation! 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20110921/8b5de594/attachment.html>

More information about the Libav-user mailing list