0

I apply filter_complex to put objects on coordinates using overlay. Sometime, I need to use the scroll filter.

Here is the code

ffmpeg -vsync 0 -i /tmp/2SN92agDIG.png -i /tmp/TogmpB9etD.png -i /tmp/lxiQXCxhaZ-1.png -filter_complex "color=size=312x312:c=0xffffff,loop=-1[color];\
[0:v]setpts=PTS-STARTPTS,setsar=1,scale=480x320,rotate=0:c=none:ow=rotw(0):oh=roth(0),format=argb,colorchannelmixer=aa=1[0];\
[1:v]setpts=PTS-STARTPTS,setsar=1,scale=298x301,rotate=0:c=none:ow=rotw(0):oh=roth(0),format=argb,colorchannelmixer=aa=0.8[1];\
[2:v]setpts=PTS-STARTPTS,setsar=1,scale=288x614,rotate=0:c=none:ow=rotw(0):oh=roth(0),format=argb,colorchannelmixer=aa=1[2];\
[color][0]overlay=x=-76.18:y=-4[-1+0];\
[-1+0][1]overlay=x=8.043499999999995:y=5.044000000000011[0+1];\
[0+1][2]overlay=x=8.021000000000015:y=0,scroll=vertical=0.02857142857142857" -map 0:a? -c:v h264_nvenc -c:a copy -t 35 -y

It works great but when this filter is applied on an object which is on top of other objects (Ex. third object in the filter complex chain), the scroll is applied to all under layer.

Do you have an idea how can I "isolate" the scroll to be applies only on one object ?

Thanks.

  • 1
    The scroll should be applied within the [2:v] filtering. – Gyan Mar 25 at 12:06
  • How can I connect the output of the filter scroll to my filter_complex ? Thanks – Julien Planchet Mar 27 at 11:22
  • Shift the scroll to after the colorchannelmixer for 2:v – Gyan Mar 27 at 11:25
  • I tried this [2:v]setpts=PTS-STARTPTS,setsar=1,scale=288x614,rotate=0:c=none:ow=rotw(0):oh=roth(0),format=argb,colorchannelmixer=aa=1,scroll=vertical=0.02857142857142857[2]; But i got Filter scroll has an unconnected output – Julien Planchet Mar 27 at 13:05
  • Add -report and rerun. Share report. – Gyan Mar 27 at 15:41
0

The image to be scrolled has to be looped first and then scrolled.

ffmpeg -vsync 0 -i /tmp/2SN92agDIG.png -i /tmp/TogmpB9etD.png -i /tmp/lxiQXCxhaZ-1.png -filter_complex "color=size=312x312:c=0xffffff[color];\
[0:v]setpts=PTS-STARTPTS,setsar=1,scale=480x320,rotate=0:c=none:ow=rotw(0):oh=roth(0),format=argb,colorchannelmixer=aa=1[0v];\
[1:v]setpts=PTS-STARTPTS,setsar=1,scale=298x301,rotate=0:c=none:ow=rotw(0):oh=roth(0),format=argb,colorchannelmixer=aa=0.8[1v];\
[2:v]setpts=PTS-STARTPTS,setsar=1,scale=288x614,rotate=0:c=none:ow=rotw(0):oh=roth(0),format=argb,colorchannelmixer=aa=1,loop=1:1,scroll=vertical=0.02857142857142857[2v];\
[color][0v]overlay=x=-76.18:y=-4[-1+0];\
[-1+0][1v]overlay=x=8.043499999999995:y=5.044000000000011[0+1];\
[0+1][2v]overlay=x=8.021000000000015:y=0" -c:v h264_nvenc -t 35 -y out.mp4

(there are quite a few unnecessary or inert elements in this command, but I haven't removed them, such as the rotate filters which don't perform any rotation)

| improve this answer | |
  • Thanks for you help, I tried with your command and the result is I only have a little movement at the beginning (less than a second) but it's fixed then – Julien Planchet Mar 30 at 6:47
  • I added like loop=-1:75:0 and it's working like a charm :) Thanks for your help – Julien Planchet Mar 30 at 6:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.