Howcan I get the colormatrix of colorchannelmixer of ffmpeg

1.2k views Asked by At

I want to add some color filter to video, just like image below: enter image description here

colorchannelmixer need a 4x4 ColorMatrix, Where can I find this ColorMatrix, or which tool can help me to figure out some ColorMatrix.

(I found a tool called ColorMatrixViewer.exe, but it's a 5x5 ColorMatrix, I just extract a 4x4 maxtrix from it and apply the 4x4 maxtix to colorchannelmixer, theirs result are different)

Thanks for your answer.

1

There are 1 answers

0
hemisphire On

I needed to tint a video orange and came up with this:

ffmpeg -i <inputfile> -vf colorchannelmixer=1:0:0:0:0:.5:0:0:0:0:0 -acodec copy -pix_fmt yuv420p <outputfile>

Alternately, I've also used a 2 step process to convert the video to black & white, then to orange:

ffmpeg -i <inputfile> -vf hue=s=0 -acodec copy <outputfile>
ffmpeg -i <outputfile> -vf colorchannelmixer=1:0:0:0:0:.5:0:0:0:0:0 -acodec copy -pix_fmt yuv420p <outputfile2>