[FFmpeg-devel] [PATCH] cache AVPacket if loop_input on a piped stream

Michael Niedermayer michaelni
Wed Nov 25 01:53:54 CET 2009


On Wed, May 27, 2009 at 05:06:18PM +0200, Peter Holik wrote:
> Hi!
> 
> I will fetch an image from a webserver and create a video.
> 
> I do this with
> 
> #> ffmpeg -r 1 -f image2pipe -vcodec png -loop_input -i "http://server/picture.png"
>           -re -f mpegts -r 25 -vcodec mpeg2video -b 4000k -an mpeg.ts
> 
> but for every png file a http request is sent.
> 
> I think this is not necessary. The picture fetched one time could be cached.
> 
> My patch caches this picture in ffmpeg.c in the input stream's AVFormatContext
> and reuses it if needed.
> 
> The caching is only done if "-loop_input" and a piped input stream is used.
> 
> please comment my idea - maybe i got also the wrong position where to cache.

a little late reply ...
anyway, i think that you can just download the image and trust the OS cache
or use a caching http proxy, ffmpeg.c does not seem to be the correct place
for this quite specific caching

at some point in the future someone might want to try to use chained demuxers
to implement a cache or write a caching protocol.
if done in ffmpeg.c OTOH it really should cache after decoding so as not to
redo decoding.

also the case of refetching from http makes sense as the file could change
and refetching could be wanted in some use cases

i think thats pretty much a reject for your patch, at least as it is

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I am the wisest man alive, for I know one thing, and that is that I know
nothing. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091125/4c664940/attachment.pgp>



More information about the ffmpeg-devel mailing list