I'm trying to add a watermark of an icon (an arrow pointing to the right) to the top right corner of two different videos using FFmpeg. Both videos have the same resolution (1280x720) and I use the same command to add the icon. In one video, the icon appears in the correct place. However, in the other video, the icon appears in the bottom right corner.

Has anyone encountered the same problem?

Screenshot of correct and misplaced watermarks

1 Answer 1


The picture on the left is a portrait video stored as landscape but with a rotation tag. So, the overlay image co-ordinates take effect with reference to the stored representation. For such cases, you should rotate the video beforehand by 1) adding the transpose filter before the overlay 2) disabling autorotate on the input video* and 3) manually resetting the rotation tag in the output, e.g.

ffmpeg -noautorotate -i input.mp4 -i arrow.png -filter_complex "[0]transpose=1[bg];[bg][1]overlay=X:Y" -metadata:s:v rotate=0 out.mp4

*not needed if your ffmpeg is from April 2015 or earlier.

To check the rotation tag for a video, you can run

ffprobe input.mp4 -show_entries stream_tags=rotate -v 0 -of compact=p=0:nk=1

You'll get an angle value. If it's 90, use transpose=1. If it's 270, use transpose=2

  • I don't have enough rep to write a comment directly,Thank you all the same.However,when I run "ffprobe -input.mp4 -show_entries stream_tags=rotate -v 0 -of compact=p=0:nk=1",my log prints that "Command validation failed.No slashes in output path looks like the : compact=p=0:nk=1 is not valid."I don't know what is the problem,can you please point it out to me?
    – 103king
    Jan 10, 2017 at 10:34
  • Sounds like you're on android and using a wrapper. You should ask on Stack Overflow on how to execute the command on Android.
    – Gyan
    Jan 10, 2017 at 13:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.