colorchannelmixerΒΆ

Watch on youtube.com
doc

https://ffmpeg.org/ffmpeg-filters.html#colorchannelmixer

Example 1

00:00:00

This example remains the default. That is, the converted video is the same as the input.

#! /bin/sh
ifn="Pexels_2877_2880.mp4"
ifnb="`basename \"${ifn}\" .mp4`"
pref="`basename $0 .sh`"

ffmpeg -y -i "${ifn}" -filter_complex "
[0:v]
colorchannelmixer=
1.000:0.000:0.000:0.000:
0.000:1.000:0.000:0.000:
0.000:0.000:1.000:0.000:
0.000:0.000:0.000:1.000
[v]" -map '[v]' -an "${pref}_${ifnb}.mp4"

Example 2

00:00:20

In this example, the red component is reduced and the green component is increased.

#! /bin/sh
ifn="Pexels_2877_2880.mp4"
ifnb="`basename \"${ifn}\" .mp4`"
pref="`basename $0 .sh`"

ffmpeg -y -i "${ifn}" -filter_complex "
[0:v]
colorchannelmixer=
0.900:0.000:0.000:0.000:
0.000:1.100:0.000:0.000:
0.000:0.000:1.000:0.000:
0.000:0.000:0.000:1.000
[v]" -map '[v]' -an "${pref}_${ifnb}.mp4"

Example 3

00:00:40

This is an example of exchanging the red component and the green component of the input.

#! /bin/sh
ifn="Pexels_2877_2880.mp4"
ifnb="`basename \"${ifn}\" .mp4`"
pref="`basename $0 .sh`"

ffmpeg -y -i "${ifn}" -filter_complex "
[0:v]
colorchannelmixer=
0.000:1.000:0.000:0.000:
1.000:0.000:0.000:0.000:
0.000:0.000:1.000:0.000:
0.000:0.000:0.000:1.000
[v]" -map '[v]' -an "${pref}_${ifnb}.mp4"

Example 4

00:01:00

This is an example in which half of the input blue component is distributed to the output red.

#! /bin/sh
ifn="Pexels_2877_2880.mp4"
ifnb="`basename \"${ifn}\" .mp4`"
pref="`basename $0 .sh`"

ffmpeg -y -i "${ifn}" -filter_complex "
[0:v]
colorchannelmixer=
0.500:0.000:0.500:0.000:
0.000:1.000:0.000:0.000:
0.000:0.000:0.500:0.000:
0.000:0.000:0.000:1.000
[v]" -map '[v]' -an "${pref}_${ifnb}.mp4"

Example 5

00:01:20

This is an example in the official document itself. It is converting to grayscale.

#! /bin/sh
ifn="Pexels_2877_2880.mp4"
ifnb="`basename \"${ifn}\" .mp4`"
pref="`basename $0 .sh`"

ffmpeg -y -i "${ifn}" -filter_complex "
[0:v]
colorchannelmixer=
0.300:0.400:0.300:0.000:
0.300:0.400:0.300:0.000:
0.300:0.400:0.300:0.000:
0.000:0.000:0.000:1.000
[v]" -map '[v]' -an "${pref}_${ifnb}.mp4"

Example 6

00:01:40

This is an example in the official document itself. It is simulating sepia tones.

#! /bin/sh
ifn="Pexels_2877_2880.mp4"
ifnb="`basename \"${ifn}\" .mp4`"
pref="`basename $0 .sh`"

ffmpeg -y -i "${ifn}" -filter_complex "
[0:v]
colorchannelmixer=
0.393:0.769:0.189:0.000:
0.349:0.686:0.168:0.000:
0.272:0.534:0.131:0.000:
0.000:0.000:0.000:1.000
[v]" -map '[v]' -an "${pref}_${ifnb}.mp4"