<p>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.</p>

<pre><code>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
</code></pre>

<p>*not needed if your ffmpeg is from April 2015 or earlier.</p>

<hr>

<p>To check the rotation tag for a video, you can run</p>

<pre><code>ffprobe input.mp4 -show_entries stream_tags=rotate -v 0 -of compact=p=0:nk=1
</code></pre>

<p>You'll get an angle value. If it's 90, use <code>transpose=1</code>. If it's 270, use <code>transpose=2</code></p>

CC BY-SA 3.0
2017-01-10T10:34:02.797Z
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
CC BY-SA 3.0
2017-01-10T13:59:27.277Z
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
CC BY-SA 3.0
2017-01-09T12:11:20.987Z
2017-01-10T05:17:56.873Z
2017-01-10T05:17:56.873Z
Gyan
<p>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.</p>

<p>Has anyone encountered the same problem?</p>

<p><a href="https://i.sstatic.net/5DlZA.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/5DlZA.png" alt="Screenshot of correct and misplaced watermarks"></a></p>

<video><ffmpeg><android>
Misplaced FFmpeg watermarks
user17693
# Misplaced FFmpeg watermarks

(Asked by: username_0 on 2017-01-09)

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](https://i.sstatic.net/5DlZA.png)](https://i.sstatic.net/5DlZA.png)

**Tags:** video, ffmpeg, android


---

## 1 answers

### Answer by username_1 on 2017-01-09. Score: 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

> **Comments:**
> **username_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?  
> **username_1**: Sounds like you're on android and using a wrapper. You should ask on Stack Overflow on how to execute the command on Android.  

---

