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

Michel Bardiaux mbardiaux
Thu Jan 17 14:23:12 CET 2008


Cristiano Belloni a ?crit :
> 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: 
> http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2007-March/024867.html
> 
> 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?

See 
http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2006-December/020068.html
and its followups

> 
> 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?

Its another possibility, However, implementing your own protocol gives 
you more control.

> 
> Please, help me! :)
> 
> Thanks,
> 
> Cristiano.
> 
> 


-- 
Michel Bardiaux
R&D Director
T +32 [0] 2 790 29 41
F +32 [0] 2 790 29 02
E mailto:mbardiaux at mediaxim.be

Mediaxim NV/SA
Vorstlaan 191 Boulevard du Souverain
Brussel 1160 Bruxelles
http://www.mediaxim.com/




More information about the ffmpeg-devel mailing list