1

Using overlay to move a image from left to right feels very stuttery, as if it's moving every 0.5 second instead of per frame.

Complete:

ffmpeg -hide_banner -y -loop 1 -r 2 -i 'bg.png' -i 'centerpiece.png' -t 30 -c:v libx264 -filter_complex "[1:v]scale=iw*2.2:ih*2.2[scaled_cen],[0:v][scaled_cen]overlay=(main_w-overlay_w)/3+(t*10):(main_h-overlay_h)/2,format=pix_fmts=yuv420p" -r 30 output.mp4

The important part is this:

[scaled_cen]overlay=(main_w-overlay_w)/3+(t*10):(main_h-overlay_h)/2

According to the ffmpeg docs, t is evaluated in seconds, but I've read elsewhere that its evaluated in MS, in any case I'd like my centerpiece to move a little bit every frame.

Here's the result of the command showing the choppyness:

https://i.imgur.com/PN4Ji1P.mp4

So far i've tried things like the blur filter and minterpolate but I'm guessing the problem resides in getting t more granular or doing tricks with the fps.

===EDIT====

After applying the answer of Mulvya it still seemed a bit jittery, but adding:

tblend=average,framestep=2,setpts=0.25*PTS

at the end of the filter but before the format filter seems to do the trick.

1

The overlay filter draws on each base or 'main' frame as given; it does not create new frames.

In your command,

ffmpeg -hide_banner -y -loop 1 -r 2 -i 'bg.png' ...

The -r 2 sets the main video's framerate to 2, hence the result.

Use

ffmpeg -hide_banner -y -loop 1 -framerate 30 -i 'bg.png' ...
1
  • Yep, that's it! I remember adding -r 30 in front of the command but I completely missed that I also had the -r 2 in there, so it just got overridden. Thanks!
    – Rohan
    Jan 10 '18 at 14: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.