I am trying to rotate an image and try to render it to MP4. But Output video is render with roted image with green background around it. My requirement is I need to changed green background to transparent.

Here is the command

ffmpeg -i Avideo.mp4  -i a.png -filter_complex "[1:v] rotate=-    
30*PI/180:c=black@:ow=rotw(iw):oh=roth(ih) [rotate];[0:v][rotate] overlay=40:10" -codec:a copy sample.mp4

Output is:

enter image description here

1 Answer 1


I changed c=black@ to c=0x00000000 and it worked for me.

ffmpeg -i Avideo.mp4  -i a.png -filter_complex "[1:v] rotate=-30*PI/180:c=0x00000000:ow=rotw(iw):oh=roth(ih) [rotate];[0:v][rotate] overlay=40:10" -codec:a copy sample.mp4

[The correct syntax is black@0 – Gyan]

ffmpeg -i Avideo.mp4  -i a.png -filter_complex "[1:v] rotate=-30*PI/180:c=black@0:ow=rotw(iw):oh=roth(ih) [rotate];[0:v][rotate] overlay=40:10" -codec:a copy sample.mp4

Both codes work. I couldnt find the correct syntax listed on the documentation page. It would be helpful if the documentation page provided examples rather than say this does that.

  • The correct syntax is black@0
    – Gyan
    Commented Jan 12, 2019 at 15:28
  • To do rotations also with jpg images, i also needed to add format=rgba, to support alpha channel. Now it looks like: format=rgba,rotate=a=$rotation:c=black@0:ow=rotw($rotation):oh=roth($rotation). Note that rotw(a), takes the radius in radians and not the size as suggested above.
    – Paul
    Commented Mar 19, 2023 at 5:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .