個別の RGB でも RGB すべてでもトーンカーブで色の調整ができる curves
は Adobe Photoshop や Gimp などのペイントツールによくある機能でこれが ffmpeg でも使える。ペイントツールで同時に表示されるヒストグラムは histogram
で表示できるが、Photoshop のようなメリハリの付いたグラフではなくて Gimp に近い感じになる。また Photoshop のトーンカーブプリセット .acv が読み込める。
公式ドキュメント:FFmpeg Filters Documentation :: curves
続きを読むオプション
- preset
プリセットを指定する- color_negative
“curves=r=0/1 0.129/1 0.466/0.498 0.725/0 1/0:g=0/1 0.109/1 0.301/0.498 0.517/0 1/0:b=0/1 0.098/1 0.235/0.498 0.423/0 1/0” - cross_process
“curves=r=0.25/0.156 0.501/0.501 0.686/0.745:g=0.25/0.188 0.38/0.501 0.745/0.815 1/0.815:b=0.231/0.094 0.709/0.874” - darker
“curves=all=0.5/0.4” - increase_contrast
“curves=all=0.149/0.066 0.831/0.905 0.905/0.98” - lighter
“curves=all=0.305/0.286 0.694/0.713” - linear_contrast
“curves=all=0.305/0.286 0.694/0.713” - medium_contrast
“curves=all=0.286/0.219 0.639/0.643” - negative
“curves=all=0/1 1/0” - strong_contrast
“curves=all=0.301/0.196 0.592/0.6 0.686/0.737” - vintage
“curves=r=0/0.11 0.42/0.51 1/0.95:g=0.50/0.48:b=0/0.22 0.49/0.44 1/0.8”
- color_negative
- red, r
赤を調整する - green, g
緑を調整する - blue, b
青を調整する - all
赤緑青を調整する - psfile
Photoshop カーブプリセット(.acv)のファイルパスを指定する
基本コマンド
青の中央値を少し明るくする
ffplay input -vf "curves=blue='0.5/0.58'"
ビンテージプリセットを指定する
ffplay input -vf "curves=r='0/0.11 .42/.51 1/0.95':g='0.50/0.48':b='0/0.22 .49/.44 1/0.8'"
ffplay input -vf curves=vintage
Photoshop カーブプリセットを指定して緑も調整する
ffplay input -vf "curves=psfile='MyCurvesPresets/purple.acv':green='0.45/0.53'"
調整前後を histogram
で比較して調べる
RGB画像を入力する場合は format=gbrp
を挟む
ffplay input_img -vf "format=gbrp,split[0][1];[0]curves=blue='0.5/0.4',histogram=mode=levels:levels_mode=logarithmic,scale=200:ih,split[l0][l1];[1]histogram=mode=levels:levels_mode=logarithmic,scale=200:ih,split[r0][r1];[l1][r1]blend=c0_mode=difference128[d0];[l0][r0][d0]hstack=3,drawgrid=0:0:20:20:c=0xd0d0d0"
関連記事
ffmpeg でヒストグラムを表示する