ffmpeg: overlay rotated video with transparency I'm new to ffmpeg (video encoding in general).

I have two videos one larger than the other. I want to rotate, resize and overlay the shorter video on the larger one at defined coordinates.

So far, I'm doing this:


Add alpha channel to both the videos: ffmpeg -i demo.mov -vcodec qtrle -pix_fmt argb demo.mov
Define fadein, fadeout, scale, overlay, perspective and rotation then output the video: ffmpeg -y -i demo.mov -i demo2.mov -filter_complex  "[1:v] fade=in:10:1:alpha=1, fade=out:500:1:alpha=1, scale=80:80, perspective=x0=0:y0=0:x1=W:y1=40, rotate=-0.1745:c=none [ov]; [0:v][ov] overlay=100:100 [v]" -map "[v]" out.mov


In this process, I'm facing a few problems:


Am I adding alpha channels the right way?
The final output has flickering background in the place where the rotated video has margins.
The overlay remains a square. I do not want it to be square, but of the dimension specified by perspective filter.


Some of the parameters in the above commands (such as perspective,fade) are arbitrary.

To give a better perspective of what I'm trying to do: trying to add a video as though it was being played on a phone that is moving.

I have asked about problems on IRC and got this far. I don't know how to proceed from here.

Here is the output: https://youtu.be/yd4UWq5NO5M

Any help would be great.
Breaking the process into two steps worked for me.

See my output using the commands below at http://sendvid.com/g56xjz04

The commands I used:

ffmpeg -y -i "video for overlay.mov" -vf "format=bgra, perspective=x0=0:y0=0:x1=W:y1=180, fade=in:10:1:alpha=1, fade=out:200:1:alpha=1, scale=-1:80, rotate=-0.1745:c=none:ow=rotw(-0.1745):oh=roth(-0.1745)" -c:v qtrle overlay.mov

ffmpeg -y -i "base.mov" -i "overlay.mov" -filter_complex "[0:v][1:v] overlay=100:100:eof_action=pass [v]" -map "[v]" final_out.mov


I suspect that in the single command complex filterchain, there is some bug or nuance regarding the alpha channel operations that is generating a garbled alpha channel.

If you need a single command, I think your best way forward is to submit a bug report to the ffmpeg team, including the commands and output of both the single command and two-step process.