ffmpeg sepia effect on video

2019-07-10 14:08发布

问题:

How can I apply simple sepia effect of a video using FFmpeg ? I am seeking for a single line FFmpeg command which I will be using in android.Though I have learnt colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131 on official FFmpeg doc , but unable to apply it properly.Thank you.

回答1:

You just need to chain the filters appropriately. But in your approach, using eq filter may be difficult to implement the sepia matrix with FFmpeg as it has an associated matrix. Instead I suggest you an easy way with colorchannelmixer.

ffmpeg -i input_video -filter_complex "
[0:v]colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131[colorchannelmixed];
[colorchannelmixed]eq=1.0:0:1.3:2.4:1.0:1.0:1.0:1.0[color_effect]" -map [color_effect] -c:v libx264 -c:a copy output_video

Here sepia is implemented using colorchannelmixer filter and it is followed by the eq filter to adjust the brightness, contrast, etc. of the video while keeping rgb colour values to their default 1.

Hope this helps you!