Misplaced FFmpeg watermarks 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?
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