mcpField
F
ffmpeg-glitch-distortion-effects

ffmpeg-glitch-distortion-effects

github.com/josiahsiegelクリエイティブ・メディア5991 回インストール19 週間前に更新
リポジトリ

ffmpeg-glitch-distortion-effects について

グリッチやアナログ風の歪みを加えたい動画編集者やクリエイター向けのFFmpegリファレンスです。datamosh、VHS、ピクセル化、CRTなどの効果に使えるフィルターコマンドと組み合わせプリセットを紹介します。

主な機能

  1. 01Datamoshとフレームブレンド
  2. 02色収差と色ずれ
  3. 03VHSとアナログ映像の再現
  4. 04ピクセル化と波形歪み
  5. 05走査線とCRT効果
  6. 06グリッチの組み合わせプリセット

活用シーン

  1. 01ミュージックビデオへのグリッチ追加
  2. 02VHS映像の再現
  3. 03ホラーやサイバーパンク風の映像制作
  4. 04動画の指定区間への歪み効果の適用

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/josiahsiegel/claude-plugin-marketplace --skill ffmpeg-glitch-distortion-effects

インストール後、Claude Code で/ffmpeg-glitch-distortion-effectsを入力して読み込まれたか確認します。

詳細

重要なガイドライン

Windows のファイルパス要件

必須:Windows ではファイルパスに常にバックスラッシュを使用してください

Windows で Edit または Write ツールを使用する場合、ファイルパスにはスラッシュ(/)ではなく、バックスラッシュ(\)を必ず使用してください。


クイックリファレンス

効果コマンド
データモッシュ-vf "minterpolate='mi_mode=mci:mc_mode=aobmc:me_mode=bidir'"
色収差-vf "rgbashift=rh=-5:bh=5"
VHS ノイズ-vf "noise=c0s=20:c0f=t,eq=saturation=1.2"
ピクセル化-vf "scale=iw/10:ih/10,scale=iw*10:ih*10:flags=neighbor"
波形歪み変位マップと組み合わせて -vf "displace=..."
エコー/残像-vf "lagfun=decay=0.95"
走査線-vf "drawgrid=w=iw:h=2:t=1:[email protected]"

このスキルを使用する場面

クリエイティブな歪み効果に使用します:

  • ミュージックビデオのグリッチ表現
  • データモッシュ/ピクセルブリーディングアート
  • VHS/アナログ映像のシミュレーション
  • デジタル破損とアーティファクト
  • サイケデリックで実験的な映像
  • ホラー/不穏な視覚効果

FFmpeg のグリッチと歪み効果(2025)

FFmpeg を使ったデータモッシュ、グリッチアート、VHS 効果、変位、クリエイティブな映像の歪みを網羅したガイドです。

データモッシュ効果

データモッシュは、動き補償を操作して「ピクセルブリーディング」効果を作り出します。

minterpolate による基本的なデータモッシュ
# Basic datamosh effect
ffmpeg -i input.mp4 \
  -vf "minterpolate='mi_mode=mci:mc_mode=aobmc:me_mode=bidir:vsbmc=1'" \
  -c:v libx264 -crf 18 datamosh.mp4

# Parameters explained:
# mi_mode=mci: Motion compensated interpolation
# mc_mode=aobmc: Adaptive overlapped block motion compensation
# me_mode=bidir: Bidirectional motion estimation
# vsbmc=1: Variable size block motion compensation
強いデータモッシュ
# Heavy datamosh (more chaos)
ffmpeg -i input.mp4 \
  -vf "minterpolate='fps=60:mi_mode=mci:mc_mode=aobmc:me_mode=bidir:me=epzs:vsbmc=1:scd=none'" \
  -c:v libx264 -crf 18 heavy_datamosh.mp4

# scd=none: Disable scene change detection (more bleeding across cuts)
# me=epzs: Enhanced predictive zonal search (faster, rougher)
フレーム操作によるデータモッシュ
# Datamosh by removing I-frames (requires re-encoding)
ffmpeg -i input.mp4 \
  -vf "minterpolate='mi_mode=mci:mc_mode=aobmc',\
       tblend=all_mode=difference:all_opacity=0.5" \
  datamosh_blend.mp4

# Combine with echo for trails
ffmpeg -i input.mp4 \
  -vf "minterpolate='mi_mode=mci:mc_mode=aobmc',lagfun=decay=0.9" \
  datamosh_trails.mp4
制御されたデータモッシュ(特定の区間)
# Datamosh only certain section
ffmpeg -i input.mp4 \
  -vf "minterpolate='mi_mode=mci:mc_mode=aobmc':enable='between(t,5,10)'" \
  controlled_datamosh.mp4

色収差

「壊れたレンズ」のような見た目を作る、色チャンネルの分離です。

rgbashift フィルター
# Horizontal chromatic aberration
ffmpeg -i input.mp4 \
  -vf "rgbashift=rh=-5:bh=5" \
  chromatic.mp4

# Parameters:
# rh/rv: Red horizontal/vertical shift
# gh/gv: Green horizontal/vertical shift
# bh/bv: Blue horizontal/vertical shift
# ah/av: Alpha horizontal/vertical shift

# Vertical chromatic aberration
ffmpeg -i input.mp4 \
  -vf "rgbashift=rv=-3:bv=3" \
  chromatic_v.mp4

# Both directions
ffmpeg -i input.mp4 \
  -vf "rgbashift=rh=-4:rv=-2:bh=4:bv=2" \
  chromatic_both.mp4
アニメーション付き色収差
# Pulsing chromatic aberration
ffmpeg -i input.mp4 \
  -vf "rgbashift=rh='5*sin(t*3)':bh='-5*sin(t*3)'" \
  pulsing_chromatic.mp4

# Increasing aberration over time
ffmpeg -i input.mp4 \
  -vf "rgbashift=rh='-t*2':bh='t*2'" \
  increasing_chromatic.mp4
chromashift フィルター(クロマのみ)
# Shift chroma channels (U/V in YUV)
ffmpeg -i input.mp4 \
  -vf "chromashift=cbh=5:crh=-5" \
  chroma_shift.mp4

# cbh/cbv: Cb (blue-difference) horizontal/vertical
# crh/crv: Cr (red-difference) horizontal/vertical

VHS/アナログ効果

VHS の完全なシミュレーション
# Full VHS effect
ffmpeg -i input.mp4 \
  -vf "\
    noise=c0s=15:c0f=t:c1s=10:c1f=t,\
    eq=saturation=1.4:contrast=1.1:brightness=-0.02,\
    chromashift=cbh=3:crh=-3,\
    rgbashift=rh=2:bh=-2,\
    unsharp=3:3:-0.5,\
    drawgrid=w=iw:h=2:t=1:[email protected],\
    curves=preset=vintage" \
  -c:v libx264 -crf 20 vhs_effect.mp4
VHS の各要素の内訳
# 1. VHS Noise (temporal noise)
ffmpeg -i input.mp4 \
  -vf "noise=c0s=20:c0f=t:c1s=15:c1f=t" \
  vhs_noise.mp4

# 2. VHS Color bleeding
ffmpeg -i input.mp4 \
  -vf "chromashift=cbh=4:cbv=2:crh=-3:crv=1" \
  vhs_color_bleed.mp4

# 3. VHS Scan lines
ffmpeg -i input.mp4 \
  -vf "drawgrid=w=iw:h=2:t=1:[email protected]" \
  vhs_scanlines.mp4

# 4. VHS Tracking issues (simulated)
ffmpeg -i input.mp4 \
  -vf "crop=iw:ih-20:0:'20*random(1)',pad=iw:ih+20:0:10" \
  vhs_tracking.mp4

# 5. VHS Oversaturated colors
ffmpeg -i input.mp4 \
  -vf "eq=saturation=1.5:contrast=1.1,curves=preset=vintage" \
  vhs_colors.mp4
VHS の静電気/スノーノイズ
# Static overlay blend
ffmpeg -f lavfi -i "nullsrc=s=1920x1080:d=10" \
  -vf "noise=c0s=100:c0f=a+t,format=gray" \
  -c:v libx264 -t 10 static.mp4

# Blend static with video
ffmpeg -i input.mp4 -i static.mp4 \
  -filter_complex "[0:v][1:v]blend=all_mode=screen:all_opacity=0.1" \
  vhs_static.mp4

ピクセル化とモザイク

基本的なピクセル化
# Pixelate entire video
ffmpeg -i input.mp4 \
  -vf "scale=iw/10:ih/10,scale=iw*10:ih*10:flags=neighbor" \
  pixelated.mp4

# Parameters:
# First scale: Reduce resolution (divide by pixelation level)
# Second scale: Scale back up with nearest neighbor (no interpolation)

# Variable pixelation level
ffmpeg -i input.mp4 \
  -vf "scale=iw/20:ih/20,scale=iw*20:ih*20:flags=neighbor" \
  heavy_pixel.mp4
アニメーション付きピクセル化
# Pixelation that increases over time
ffmpeg -i input.mp4 \
  -vf "scale='iw/max(1,t*2)':'ih/max(1,t*2)',scale=iw:ih:flags=neighbor" \
  animated_pixel.mp4

# Note: This is approximate; true animated requires geq or external scripts
モザイク/検閲効果
# Mosaic specific region (face blur style)
ffmpeg -i input.mp4 \
  -filter_complex "\
    [0:v]crop=200:200:300:200[face];\
    [face]scale=iw/10:ih/10,scale=iw*10:ih*10:flags=neighbor[blurred];\
    [0:v][blurred]overlay=300:200" \
  mosaic_region.mp4

波形と波紋の歪み

変位マップ
# Create displacement map (gradient)
ffmpeg -f lavfi -i "gradients=s=1920x1080:c0=black:c1=white:x0=0:y0=540:x1=1920:y1=540" \
  -vframes 1 displacement_h.png

# Apply horizontal wave displacement
ffmpeg -i input.mp4 -i displacement_h.png \
  -filter_complex "[0:v][1:v]displace=edge=wrap" \
  wave_h.mp4
geq によるアニメーション付き波形
# Horizontal wave using geq
ffmpeg -i input.mp4 \
  -vf "geq=lum='lum(X+10*sin(Y/20+T*5),Y)':cb='cb(X+10*sin(Y/20+T*5),Y)':cr='cr(X+10*sin(Y/20+T*5),Y)'" \
  wave_animated.mp4

# Vertical wave
ffmpeg -i input.mp4 \
  -vf "geq=lum='lum(X,Y+10*sin(X/20+T*5))':cb='cb(X,Y+10*sin(X/20+T*5))':cr='cr(X,Y+10*sin(X/20+T*5))'" \
  wave_v.mp4

# Ripple from center
ffmpeg -i input.mp4 \
  -vf "geq=lum='lum(X+5*sin(sqrt(pow(X-W/2,2)+pow(Y-H/2,2))/10-T*5),Y+5*cos(sqrt(pow(X-W/2,2)+pow(Y-H/2,2))/10-T*5))':cb='cb(X,Y)':cr='cr(X,Y)'" \
  ripple.mp4
lenscorrection(樽型/糸巻き型)
# Barrel distortion (fisheye-like)
ffmpeg -i input.mp4 \
  -vf "lenscorrection=cx=0.5:cy=0.5:k1=0.5:k2=0.5" \
  barrel.mp4

# Pincushion distortion (opposite of barrel)
ffmpeg -i input.mp4 \
  -vf "lenscorrection=cx=0.5:cy=0.5:k1=-0.3:k2=-0.3" \
  pincushion.mp4

# Parameters:
# cx, cy: Lens center (0-1, 0.5 = center)
# k1, k2: Distortion coefficients (positive = barrel, negative = pincushion)

エコーと残像(lagfun)

基本的な残像
# Motion trails
ffmpeg -i input.mp4 \
  -vf "lagfun=decay=0.95" \
  trails.mp4

# Parameters:
# decay: How fast trails fade (0-1, higher = longer trails)

# Heavy trails
ffmpeg -i input.mp4 \
  -vf "lagfun=decay=0.98" \
  heavy_trails.mp4

# Light trails
ffmpeg -i input.mp4 \
  -vf "lagfun=decay=0.85" \
  light_trails.mp4
色付きの残像
# Trails with color shift
ffmpeg -i input.mp4 \
  -vf "lagfun=decay=0.95,hue=h=t*10" \
  color_trails.mp4

# Inverted trails (bright areas leave dark trails)
ffmpeg -i input.mp4 \
  -vf "negate,lagfun=decay=0.95,negate" \
  inverted_trails.mp4

フレームのブレンド(tmix、tblend)

tmix(時間方向のミックス)
# Average 5 frames (motion blur effect)
ffmpeg -i input.mp4 \
  -vf "tmix=frames=5:weights='1 1 1 1 1'" \
  motion_blur.mp4

# Echo effect (repeat previous frames)
ffmpeg -i input.mp4 \
  -vf "tmix=frames=10:weights='1 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1'" \
  echo.mp4

# Ghosting
ffmpeg -i input.mp4 \
  -vf "tmix=frames=3:weights='1 0.5 0.25'" \
  ghosting.mp4
tblend(フレーム差分)
# Frame difference (motion highlight)
ffmpeg -i input.mp4 \
  -vf "tblend=all_mode=difference" \
  frame_diff.mp4

# Available modes:
# addition, addition128, multiply, multiply128
# average, difference, difference128
# divide, exclusion, extremity, freeze
# glow, hardlight, hardmix, heat
# lighten, darken, linearlight, negation
# normal, overlay, phoenix, pinlight
# reflect, screen, softdifference
# softlight, stain, subtract, vividlight, xor
tblend を使ったクリエイティブな効果
# Neon edges
ffmpeg -i input.mp4 \
  -vf "tblend=all_mode=difference128,eq=brightness=0.1:contrast=2" \
  neon_edges.mp4

# Psychedelic blend
ffmpeg -i input.mp4 \
  -vf "tblend=all_mode=phoenix" \
  psychedelic.mp4

# Burn effect
ffmpeg -i input.mp4 \
  -vf "tblend=all_mode=heat" \
  burn_effect.mp4

デジタル破損

ランダムなアーティファクト
# Digital glitch noise
ffmpeg -i input.mp4 \
  -vf "\
    noise=c0s=30:c0f=a+t:c1s=20:c1f=a+t,\
    rgbashift=rh='5*random(1)':bh='-5*random(1)'" \
  digital_glitch.mp4

# Note: random() generates noise, but isn't truly random between frames
圧縮アーティファクトのシミュレーション
# Heavy compression artifacts
ffmpeg -i input.mp4 \
  -c:v libx264 -crf 51 -preset ultrafast \
  temp_compressed.mp4

ffmpeg -i temp_compressed.mp4 \
  -c:v libx264 -crf 18 \
  artifacts.mp4

# Blocky artifacts with multiple re-encodes
for i in {1..5}; do
  ffmpeg -y -i input.mp4 -c:v libx264 -crf 40 temp.mp4
  mv temp.mp4 input.mp4
done
ビット操作(geq)
# Bit-depth reduction (posterization)
ffmpeg -i input.mp4 \
  -vf "geq=lum='floor(lum(X,Y)/32)*32':cb='floor(cb(X,Y)/32)*32':cr='floor(cr(X,Y)/32)*32'" \
  bit_crush.mp4

# XOR pattern
ffmpeg -i input.mp4 \
  -vf "geq=lum='bitxor(lum(X,Y),X+Y)':cb='cb(X,Y)':cr='cr(X,Y)'" \
  xor_pattern.mp4

走査線と CRT 効果

走査線
# Horizontal scan lines
ffmpeg -i input.mp4 \
  -vf "drawgrid=w=iw:h=2:t=1:[email protected]" \
  scanlines.mp4

# Heavier scan lines
ffmpeg -i input.mp4 \
  -vf "drawgrid=w=iw:h=4:t=2:[email protected]" \
  heavy_scanlines.mp4

# RGB scan lines (trinitron style)
ffmpeg -i input.mp4 \
  -vf "drawgrid=w=3:h=ih:t=1:[email protected]" \
  rgb_scanlines.mp4
CRT のシミュレーション
# Full CRT effect
ffmpeg -i input.mp4 \
  -vf "\
    gblur=sigma=0.5,\
    drawgrid=w=iw:h=2:t=1:[email protected],\
    vignette=PI/4,\
    eq=saturation=1.2:contrast=1.1,\
    lenscorrection=k1=0.1:k2=0.1,\
    noise=c0s=5:c0f=t" \
  crt_effect.mp4
インターレース効果
# Add interlacing artifacts
ffmpeg -i input.mp4 \
  -vf "interlace=scan=tff,fieldorder=bff" \
  interlaced.mp4

# Fake interlacing (comb effect)
ffmpeg -i input.mp4 \
  -vf "tinterlace=merge" \
  comb_effect.mp4

ミラーと万華鏡

ミラー効果
# Horizontal mirror (left to right)
ffmpeg -i input.mp4 \
  -vf "crop=iw/2:ih:0:0,split[a][b];[b]hflip[b];[a][b]hstack" \
  mirror_h.mp4

# Vertical mirror (top to bottom)
ffmpeg -i input.mp4 \
  -vf "crop=iw:ih/2:0:0,split[a][b];[b]vflip[b];[a][b]vstack" \
  mirror_v.mp4

# Quad mirror (kaleidoscope-lite)
ffmpeg -i input.mp4 \
  -vf "\
    crop=iw/2:ih/2:0:0,split=4[a][b][c][d];\
    [b]hflip[b];[c]vflip[c];[d]hflip,vflip[d];\
    [a][b]hstack[top];[c][d]hstack[bottom];\
    [top][bottom]vstack" \
  quad_mirror.mp4

組み合わせグリッチプリセット

ミュージックビデオのグリッチ
ffmpeg -i input.mp4 \
  -vf "\
    minterpolate='mi_mode=mci:mc_mode=aobmc':enable='lt(mod(t,2),0.2)',\
    rgbashift=rh='3*sin(t*10)':bh='-3*sin(t*10)',\
    lagfun=decay=0.9:enable='gt(mod(t,3),2.5)',\
    noise=c0s=10:c0f=t:enable='lt(mod(t,5),0.3)'" \
  -c:v libx264 -crf 18 music_glitch.mp4
ホラーグリッチ
ffmpeg -i input.mp4 \
  -vf "\
    eq=brightness=-0.1:contrast=1.2:saturation=0.7,\
    chromashift=cbh='5*random(1)':crh='-3*random(1)',\
    noise=c0s=15:c0f=a+t,\
    tblend=all_mode=difference:all_opacity=0.1:enable='lt(mod(t,3),0.1)',\
    drawgrid=w=iw:h=2:t=1:[email protected]" \
  horror_glitch.mp4
サイバーパンクグリッチ
ffmpeg -i input.mp4 \
  -vf "\
    eq=saturation=1.5:contrast=1.3,\
    colorbalance=rs=0.2:bs=0.2,\
    rgbashift=rh='-3':bh='3',\
    drawgrid=w=iw:h=3:t=1:[email protected],\
    unsharp=5:5:1.5" \
  cyberpunk.mp4
アナログテレビの信号ロス
ffmpeg -i input.mp4 \
  -vf "\
    noise=c0s=50:c0f=t:enable='lt(mod(t,10),0.5)',\
    chromashift=cbh='10*random(1)':enable='lt(mod(t,10),0.5)',\
    eq=brightness='-0.3*lt(mod(t,10),0.5)'" \
  signal_loss.mp4

パフォーマンスに関するヒント

  1. geq は CPU 負荷が高いです - 使用は控えるか、短いクリップに使用してください
  2. minterpolate は低速です - 先に解像度を下げることを検討してください
  3. lagfun は効果が蓄積します - 定期的に「リセット」カットが必要になる場合があります
  4. 動画全体を処理する前に、短いクリップでテストしてください
  5. ハードウェアエンコード - 効果を適用した後の最終エンコードには NVENC/QSV を使用してください
# Process effects, then encode with hardware
ffmpeg -i input.mp4 \
  -vf "your_glitch_filters" \
  -c:v rawvideo -f nut - | \
ffmpeg -i - \
  -c:v h264_nvenc -preset p4 -cq 20 \
  output.mp4

このガイドでは、FFmpeg のグリッチと歪み効果を扱います。カラーグレーディングについては ffmpeg-color-grading-chromakey を、トランジションについては ffmpeg-transitions-effects を参照してください。

コメント