[FFmpeg-user] ~50% performance difference overlaying static image with png series using -vf/-filter_complex

Paul B Mahol onemda at gmail.com
Fri Aug 23 15:03:34 CEST 2013


On 8/23/13, d-fens <d-fens at 00010111.de> wrote:
> Zitat von Paul B Mahol <onemda at gmail.com>:
>
>> On 8/23/13, d-fens <d-fens at 00010111.de> wrote:
>>> Zitat von Paul B Mahol <onemda at gmail.com>:
>>>
>>>> On 8/23/13, d-fens <d-fens at 00010111.de> wrote:
>>>>> Zitat von Paul B Mahol <onemda at gmail.com>:
>>>>>
>>>>>> On 8/22/13, d-fens <d-fens at 00010111.de> wrote:
>>>>>>> hi,
>>>>>>>
>>>>>>> i have a background png and a sequence of pngs with transparency
>>>>>>> which
>>>>>>> should overlay the background.
>>>>>>>
>>>>>>> when i use
>>>>>>>
>>>>>>> ./ffmpeg -i %04d.png -vf "movie=bg.png [bg]; [in] format=rgb32,
>>>>>>> split
>>>>>>> [T1], fifo, [bg] overlay=0:0, [T2] overlay=0:0 [out]; [T1] fifo
>>>>>>> [T2]"
>>>>>>> out.mp4
>>>>>>>
>>>>>>> (taken from
>>>>>>> http://stackoverflow.com/questions/10438713/overlay-animated-images-with-transparency-over-a-static-background-image-using-f)
>>>>>>> i get arround 13fps for fullHD images, but using
>>>>>>>
>>>>>>> ./ffmpeg -loop 1 -i bg.png -i %04d.png -filter_complex
>>>>>>> overlay=shortest=1 out.mp4
>>>>>>
>>>>>> Try removing loop and shortest.
>>>>>
>>>>>
>>>>> this just outputs one frame, so no success :(
>>>>
>>>> Than change order of streams - make bg.png 2nd.
>>>
>>> well that puts the background over the sequence, its fast (15fps
>>> processing) though :| but very static ...
>>
>> I didn't benchmark but I assume -loop takes most of time as it decodes
>> same file over and over again.
>> So instead adding looping of main input inside overlay it would be
>> better to add generic solution:
>> repeat filter which would repeat each frame [0-inf] times.
>>
>   yes, i also think the png gets re-read in a loop, maybe
> http://git.videolan.org/?p=ffmpeg.git;a=commit;h=6e643239d9956ce32888d87451706ee7c8757afa
> speeds it up a bit,

That speeds decoding of multiple frames, so should improve both cases.

> but a repeat filter would be great or loop without the
> overhead. But just to be clear: there is no way to archive this with current
> -filter_complex
> yet?

I think so. But I guess you could use 2 overlays like you did with non
filter_complex case.
(yes, extra overlay is not nice ....)


More information about the ffmpeg-user mailing list