Skip to content

Commit fd53712

Browse files
committed
Color inversion with ffmpeg
1 parent dc047ef commit fd53712

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

media/color-inversion.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Color inversion with ffmpeg
2+
3+
```powershell
4+
ffmpeg -i input.mp4 -vf "negate,hue=h=180,eq=contrast=1.2:saturation=1.1" output.mp4
5+
```
6+
## Demo
7+
#### Before
8+
9+
<video width="820" controls>
10+
<source src="https://github.com/user-attachments/assets/a6969533-a1f9-4a8f-9203-dd151f4c6aa7" type="video/mp4">
11+
</video>
12+
13+
<!-- to display video on GitHub Markdown -->
14+
https://github.com/user-attachments/assets/a6969533-a1f9-4a8f-9203-dd151f4c6aa7
15+
16+
#### After
17+
18+
<video width="820" controls>
19+
<source src="https://github.com/user-attachments/assets/16785da7-4ed3-48c5-ad3e-b1223987c49e" type="video/mp4">
20+
</video>
21+
22+
<!-- to display video on GitHub Markdown -->
23+
https://github.com/user-attachments/assets/16785da7-4ed3-48c5-ad3e-b1223987c49e
24+
25+
26+
## Explanation
27+
The `-i input.mp4` part specifies the input file.
28+
29+
The `-vf` flag stands for "video filter," and it is followed by a series of filters applied to the video.
30+
31+
The filters are:
32+
33+
- `negate`: This filter inverts the colors of the video, creating a negative effect.
34+
- `hue=h=180`: This filter adjusts the hue of the video by 180 degrees, effectively rotating the color wheel to change the overall color tone.
35+
- `eq=contrast=1.2:saturation=1.1`: This filter adjusts the contrast and saturation of the video. The contrast=1.2 increases the contrast by 20%, making the darks darker and the lights lighter. The saturation=1.1 increases the saturation by 10%, making the colors more vivid.
36+
37+
38+
39+
Combining these filters results in a video with inverted colors, a shifted hue, and enhanced contrast and saturation. The processed video is then saved as output.mp4.
40+
41+
42+
*[source:
43+
Rubber Duck Thursdays!](https://www.youtube.com/watch?v=o7b6t6uZJPA)*

0 commit comments

Comments
 (0)