<p>Use</p>

<pre><code> ffmpeg -i IN.MOV
        -filter_complex "[0]split=2[full][crop];
                         [crop]crop=W:H:X:Y,transpose=cclock[crop];
                         [full][crop]overlay='X+h/2-w/2':'Y+w/2-h/2'"   out.mp4
</code></pre>

<p>The video is split with one copy getting cropped and rotated. The other full copy remains full-sized. Then the edited portion is overlaid on the full portion.</p>

<p>The variables in capital letters should be replaced with your numerical values.</p>

CC BY-SA 4.0
2018-12-15T08:25:46.130Z
2018-12-15T08:25:46.130Z
Gyan
<p>I tried to solve this for quite some time now and could not find the solution. I would like to select a certain "subarea" of a video and rotate/flip only that "subarea". Like a combination of these two one liners:</p>

<pre><code>ffmpeg -i IN.mov -filter:v "hflip,vflip" -c:a copy out.mov
ffmpeg -i IN.MOV -filter:v "crop=out_w:out_h:x:y" out.mp4
</code></pre>

<p>Thank you for any help. </p>

CC BY-SA 4.0
2018-12-13T13:24:34.290Z
Do you want to discard the rest of the image?
Gyan
CC BY-SA 4.0
2018-12-13T15:39:41.337Z
No, I want to keep it.
digit
CC BY-SA 4.0
2018-12-13T15:53:15.990Z
What should appear in the background after the area is rotated?
Gyan
CC BY-SA 4.0
2018-12-15T07:44:38.947Z
Yes, select an area rotate it and paste it back into the same vid rotated. Background stays the same. Thanks
digit
<ffmpeg>
Rotate only a certain part of a frame
digit
# Rotate only a certain part of a frame

(Asked by: username_0 on 2018-12-13)

I tried to solve this for quite some time now and could not find the solution. I would like to select a certain "subarea" of a video and rotate/flip only that "subarea". Like a combination of these two one liners:
ffmpeg -i IN.mov -filter:v "hflip,vflip" -c:a copy out.mov
ffmpeg -i IN.MOV -filter:v "crop=out_w:out_h:x:y" out.mp4

Thank you for any help.

**Tags:** ffmpeg

> **Comments:**
> **username_1**: Do you want to discard the rest of the image?  
> **username_0**: No, I want to keep it.  
> **username_1**: What should appear in the background after the area is rotated?  
> **username_0**: Yes, select an area rotate it and paste it back into the same vid rotated. Background stays the same. Thanks  

---

## 1 answers

### Answer by username_1 on 2018-12-15. Score: 1 | Accepted answer

Use
 ffmpeg -i IN.MOV
        -filter_complex "[0]split=2[full][crop];
                         [crop]crop=W:H:X:Y,transpose=cclock[crop];
                         [full][crop]overlay='X+h/2-w/2':'Y+w/2-h/2'"   out.mp4

The video is split with one copy getting cropped and rotated. The other full copy remains full-sized. Then the edited portion is overlaid on the full portion.
The variables in capital letters should be replaced with your numerical values.


---

