Hi everyone! 

I'm sending this to the mailing list (instead of the bug tracker) because I
don't know if this change was intended, or if this is a regression.


  Context
  =======

I have a stream where the frame dimensions are not fixed. A way to recreate a
stream like that is with this command:


    $ ffmpeg -f lavfi -i '
        color = teal : r=60,
        drawtext = fontsize=h/4 : text=%{n} : y=(h-th)/2 : x=(w-tw)/2,
        scale = iw+ceil(n*1.5) : -1 : eval=frame' 


`color + drawtext` renders a counter on top of a solid color, and `scale` with
the `n` variable is used to make every frame slightly larger than the previous
one.

These frames can be used with `overlay` to create a video with a fixed size.
One way to do it is with a single `lavfi` input:


    $ ffmpeg \
        -f lavfi \
        -i '
            color = teal : r=60,
            drawtext = fontsize=h/4 : text=%{n} : y=(h-th)/2 : x=(w-tw)/2,
            scale = iw+ceil(n*1.5) : -1 : eval=frame [a];

            color = navy : s=hd720 : r=60 [bg];
            [bg][a] overlay = (W-w)/2 : (H-h)/2 ' \
        -t 3 \
        output.mp4


An alternative command is using `overlay` in `-filter_complex`, so the input
is the stream with variable-size frames:


    $ ffmpeg \
        -f lavfi \
        -i '
            color = teal : r=60,
            drawtext = fontsize=h/4 : text=%{n} : y=(h-th)/2 : x=(w-tw)/2,
            scale = iw+ceil(n*1.5) : -1 : eval=frame ' \
        -filter_complex '
            color = navy : s=hd720 : r=60 [bg];
            [bg][0] overlay = (W-w)/2 : (H-h)/2 ' \
        -t 3 \
        output.mp4



  The Problem
  ===========

Since FFmpeg 9.0, the command with `-filter_complex` (which is much closer to
what I'm actually doing) is not working as before. The other command has no
issues.

I tested 4 different versions: 7.1.5, 8.1.3, 9.0, and the current master branch
(commit `37515cfd87`). In 7.1 and 8.1, both commands produce the same output.

However, since 9.0 with `-filter_complex`, 1 out of every 2 frames from the
input is lost, so the output of `overlay` is just the background. The video has
a lot of flickering. In [1] you can see the generated videos from every version.

 [1]: https://gist.github.com/ayosec/937df3a7f5797621434e12f1f2570274

A similar problem happens when frames are loaded from images (`-i foo%d.jpg`)
with different sizes.


Is this change intended? If it is intended, is there any way to generate a video
with the previous behaviour (not losing frames with variable dimensions)?
_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to