1

According to this link Sendcmd in ffmpeg I'm trying to have some rotating and scaling overlays

I need to add some images over the video and move-rotate-scale them on needed frame or duration time.

My test.cmd is

0
overlay@1 x 10,
overlay@1 y 10,
overlay@2 x 20,
overlay@2 y 20,
overlay@3 x 30,
overlay@3 y 30,
rotate@1 angle '45*PI/180';


2.25
overlay@1 x 20,
overlay@1 y 20,
overlay@2 x 30,
overlay@2 y 30,
overlay@3 x 40,
overlay@3 y 40,
rotate@1 angle '90*PI/180';

My command is

ffmpeg -i video.mp4 -i mask1.png -i mask2.png -i mask3.png -filter_complex "[0:v]sendcmd=f=test.cmd,nullsink;[1:v]rotate@1[rotate1];[2:v]rotate@2[rotate2];[3:v]rotate@3[rotate3];[0:v][rotate1]overlay@1[bg1];[bg1][rotate2]overlay@2[bg2];[bg2][rotate3]overlay@3[v]" -map "[v]" -map 0:a? -c:a copy OUT.mp4

1st image rotates only once at 0 duration ((

1) What's wrong with my code?

2) How can I have transparent rotation in this situation? Where to plase the c parameter for rotation?

Sendcmd is wery poor documented in ffmpeg docs, I think ((

1 Answers1

1

1) What's wrong with my code?

With the image inputs, not sendcmd. -i mask1.png only generates one frame of the image, so there is no frame at time 2.25s. Add -loop 1 before, to generate a video stream.

Where to plase the c parameter for rotation?

Inside the rotate filter, so [1:v]rotate@1=c=black@0[rotate1]

Since the images are now looped, you should add shortest=1 to the overlay filters.

Gyan
  • 85,394
  • 9
  • 169
  • 201
  • _-i mask1.png only generates one frame of the image, so there is no frame at time 2.25s_ But overlay filter works and positions of the images are changeing successfully. – Сергей Сергеев Jan 31 '19 at 15:26
  • The overlays have the video file as their base input, and the overlay filter repeats the last frame when the secondary input has finished. – Gyan Jan 31 '19 at 15:37
  • just trying it and it works like a charm. Thank you!!! One more question. Can I use frame number instead of duration in .cmd file? – Сергей Сергеев Feb 01 '19 at 08:50
  • No. The parser only expects timestamps. – Gyan Feb 01 '19 at 09:09
  • Understanding, ok. By the way, is there any way to use one cmd file per added overlay? If I need to add more than 2 images with a lot of movements and rotations, it is not comfortable to have one cmd file in this situation. – Сергей Сергеев Feb 01 '19 at 18:13