0

I would like to apply a .png on two frames of my input video but I'm having trouble using an if statement to determine the location of the overlay.

Expected:
Frame n°7 -> Frame n°7 + overlay.png with pos(300,700)
Frame n°12 -> Frame n°12 + overlay.png with pos(0,0)
Frame n°?? -> Frame n°??

Here is the ffmpeg command found on this post with similar use-cases: How to have an overlay move to specific points at specific frames using ffmpeg

ffmpeg -i input.mkv -i overlay.png -filter_complex "[0:v][1:v]overlay=x='if(eq(n,7),300,0)':y='if(eq(n,7),700,0)':enable='eq(n,7)+eq(n,12)'[out]" -map [out] output.mkv

But in my case, the if condition x='if(eq(n,7),300,0)' and y='if(eq(n,7),700,0)' always return false and I do not understand why this is happening.

Thanks!

2
  • ...:enable='eq(n,6... in x y → n starts from 1? in enable → n starts from 0? May 3 at 12:59
  • @БаярГончикжапов It works! Thank you very much!
    – legeba
    May 3 at 13:21

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.