Search code examples
videoffmpegrotation

FFMPEG rotate command show black color on edges


i am using command ffmpeg -i NoAudio.mp4 -i cat-face-emoji.png -filter_complex "[1]rotate=a=140[ov1];[0][ov1]overlay=480:270" -c:a copy output.mp4 -y to rotate image 140 degree but black background show on edges.

Here output video: https://app.dadan.io/video/share/nmmU8uiyCl2YVYm4

I am expecting to rotate image without any additional edges as the image in png.


Solution

  • By default the rotate filter uses black color to fill the output area not covered by the rotated image. You may force it to not print background (fillcolor=none) or fill with any color with zero value of alpha component (fillcolor=0x00000000), e.g.:

    ffmpeg -hide_banner -y \
      -i NoAudio.mp4 \
      -i cat-face-emoji.png \
      -filter_complex "[1]rotate=a=140:fillcolor=0x00000000[ov1];[0][ov1]overlay=480:270" \
      output.mp4