[FFmpeg-trac] #7101(avfilter:new): Overlay wrongly enabled before specified time

FFmpeg trac at avcodec.org
Thu Mar 22 19:23:13 EET 2018

#7101: Overlay wrongly enabled before specified time
             Reporter:  slhck     |                     Type:  defect
               Status:  new       |                 Priority:  normal
            Component:  avfilter  |                  Version:  git-master
             Keywords:  overlay   |               Blocked By:
             Blocking:            |  Reproduced by developer:  0
Analyzed by developer:  0         |
 I want to show a "loading" spinner at a given time for a given amount of
 time, overlaid on top of a video. The video should freeze underneath the

 In the following case, I want to show the spinner as an "initial loading"
 for 4 seconds, then at 10 seconds (media time) for 0.5 s, etc. At the same
 time, the video is looped (size = 1 frame) for the same amount of time.

 Consider the following command:

 ffmpeg \
 -y \
 -f lavfi -i
 testsrc=duration=60:size=320x240:rate=60,format=pix_fmts=yuv420p \
 -i click_and_count.m4a \
 -filter_complex " \
     [0:v] \
         loop=loop=240:size=1:start=0, setpts=N/FRAME_RATE/TB, \
         loop=loop=30:size=1:start=840, setpts=N/FRAME_RATE/TB, \
         loop=loop=84:size=1:start=1140, setpts=N/FRAME_RATE/TB, \
         loop=loop=48:size=1:start=1548, setpts=N/FRAME_RATE/TB \
     [stallvid]; \
 setpts=N/(FRAME_RATE*TB)*2 \
     [spinner]; \
     [stallvid][spinner] \
     [1:a] \
         aloop=loop=192000:size=1:start=0, asetpts=N/SAMPLE_RATE/TB, \
         aloop=loop=24000:size=1:start=672000, asetpts=N/SAMPLE_RATE/TB, \
         aloop=loop=67200:size=1:start=912000, asetpts=N/SAMPLE_RATE/TB, \
         aloop=loop=38400:size=1:start=1238399, asetpts=N/SAMPLE_RATE/TB, \
     [outa] \
 " -shortest -map "[outv]" -map "[outa]" output.mp4

 The spinner is indeed shown exactly when the 10 appears in the video (at
 00:00:14), but it is also shown for exactly one frame, four frames before
 the 10 appears.

 This should of course not happen, as the overlay is only enabled between
 14 and 14.5.

Ticket URL: <https://trac.ffmpeg.org/ticket/7101>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker

More information about the FFmpeg-trac mailing list