[FFmpeg-devel] How to write frames in a memory buffer, instead of a file?

Cristiano Belloni belloni
Wed Jan 16 18:34:23 CET 2008

Cristiano Belloni wrote:
> Hi to all,
> I'm using ffmpeg to encode H263 and MPEG4 videos.
> I take frames from a shared memory buffer, and encode them in a file, 
> opening it with the url_fopen() function, and writing on it with 
> av_write_frame() after the avcodec_encode_video() call.
> As I' m streaming rtp packets with live555, I'd like to know if it's 
> possible to store in a memory buffer the frame I would write on the file 
> with the av_write_frame() function I use now.
> And if it's possible, how do you do it? (which functions of the API do 
> you use, and how?)
> Thanks to you all,
> Regards,
> Cristiano.
I found this thread here: 

It says:

> [...] the suggested method of passing a pointer 
> through an url string is probably more robust against libavformat 
> internal changes. [...]

Is it possible to pass a pointer to a buffer through an url string? And how?

Also, this page, http://lab.dyne.org/Ffmpeg/UseUrlProtocol, despite 
giving an example of the tcp: protocol, names the function

url_open_dyn_buf (&format_context -> pb)

Is it the way to go? if I open a dynamic buffer and av_write_frame on 
it, the frame will be in the dynamic buffer?

Please, help me! :)



Belloni Cristiano
Imavis Srl.
www.imavis.com <http://www.imavis.com>
belloni at imavis.com <mailto://belloni at imavis.com>

More information about the ffmpeg-devel mailing list