[FFmpeg-user] image Overlay

Alexandre FERRIEUX - RD/SIRP/LAN alexandre.ferrieux at orange.com
Mon Jan 2 19:13:54 CET 2012


On 02/01/2012 14:34, Stefano Sabatini wrote:
> On date Monday 2012-01-02 13:54:17 +0100, Lorenz Martens encoded:
>> Hi all,
>> first of all I want to wish you a happy new Year!
>>
>> I have a project to solve within the next week:
>>
>> Is it possible with ffmpeg to create an image overlay from a given timecode to a given timecode?
>>
>> Example: I have a 8h video file and want to insert an overlay image
>> from timcode 01:32:20 to 1:53:20 and a different one from 02:03:10
>> to 02:30:20!
>>
>> I'm using ubuntu server LTS 10.4 with latest an greatest ffmpeg :D
>>
>> Any help or hint would be fine.
>
> Right now you can't do that by using the overlay, you need a
> multi-steps process, where you need to split the file, overlay just in
> the interested segments and merge again the modified segments, or
> create an ad-hoc video to overlay which shows the image only in the
> interested intervals.
>
> In order to achieve what you want with overlay, you may need to extend
> the filter, support x:y position per-frame evaluation and/or add
> support to event-driven reconfiguration, like it is done in drawtext,
> patches or a feature request are welcome.

A possible alternative to these extensions:

   - allow frames to have a transparent color, or a mask bitmap, usable for padding.

   - create a "sequence" video source that would internally concatenate the decoded sources

Then, the example becomes:

   - Assume S is the original source, OV1 and OV2 the two short sequences

   - let t1, t2, t3 be the durations of the holes outside OV1+OV2

Result is then (liberal syntax, not that of vf, for readability)

  Overlay(
    S,
    Seq(
      Color(transp,t1),
      OffPad(OV1,..,transp),
      Color(transp,t2),
      OffPad(OV2,..,transp),
      Color(transp,t3)
    )
  )

Of course that's not the way current vfs are designed, but it is more modular. Please comment/destroy.

-Alex


More information about the ffmpeg-user mailing list