ffmpeg-glitch-distortion-effects

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

CRITICAL GUIDELINES

重要指南

Windows File Path Requirements

Windows文件路径要求

MANDATORY: Always Use Backslashes on Windows for File Paths
When using Edit or Write tools on Windows, you MUST use backslashes (
\
) in file paths, NOT forward slashes (
/
).

强制要求:在Windows系统中使用文件路径时必须使用反斜杠(
\
在Windows系统中使用编辑或写入工具时,文件路径必须使用反斜杠(
\
),而非正斜杠(
/
)。

Quick Reference

快速参考

EffectCommand
Datamosh
-vf "minterpolate='mi_mode=mci:mc_mode=aobmc:me_mode=bidir'"
Chromatic aberration
-vf "rgbashift=rh=-5:bh=5"
VHS noise
-vf "noise=c0s=20:c0f=t,eq=saturation=1.2"
Pixelate
-vf "scale=iw/10:ih/10,scale=iw*10:ih*10:flags=neighbor"
Wave distortion
-vf "displace=..."
with displacement map
Echo/trails
-vf "lagfun=decay=0.95"
Scan lines
-vf "drawgrid=w=iw:h=2:t=1:c=black@0.5"
特效命令
数据杂糅(Datamosh)
-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:c=black@0.5"

When to Use This Skill

何时使用该技能

Use for creative distortion effects:
  • Music video glitch aesthetics
  • Datamosh/pixel bleeding art
  • VHS/analog video simulation
  • Digital corruption and artifacts
  • Psychedelic and experimental video
  • Horror/unsettling visual effects

适用于创意扭曲特效制作
  • 音乐视频故障美学风格
  • 数据杂糅/像素溢出艺术
  • VHS/模拟视频效果模拟
  • 数字损坏与伪影效果
  • 迷幻与实验性视频
  • 恐怖/不安视觉效果

FFmpeg Glitch & Distortion Effects (2025)

FFmpeg故障与扭曲特效(2025版)

Complete guide to datamosh, glitch art, VHS effects, displacement, and creative video distortion with FFmpeg.
使用FFmpeg实现数据杂糅、故障艺术、VHS效果、位移映射及创意视频扭曲的完整指南。

Datamosh Effects

数据杂糅特效

Datamosh creates the "pixel bleeding" effect by manipulating motion compensation.
数据杂糅通过操控运动补偿来实现“像素溢出”效果。

Basic Datamosh with minterpolate

使用minterpolate实现基础数据杂糅

bash
undefined
bash
undefined

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
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

mi_mode=mci: 运动补偿插值

mc_mode=aobmc: Adaptive overlapped block motion compensation

mc_mode=aobmc: 自适应重叠块运动补偿

me_mode=bidir: Bidirectional motion estimation

me_mode=bidir: 双向运动估计

vsbmc=1: Variable size block motion compensation

vsbmc=1: 可变尺寸块运动补偿

undefined
undefined

Intense Datamosh

高强度数据杂糅

bash
undefined
bash
undefined

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
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)

scd=none: 禁用场景变化检测(镜头切换时溢出更明显)

me=epzs: Enhanced predictive zonal search (faster, rougher)

me=epzs: 增强预测区域搜索(速度更快,效果更粗糙)

undefined
undefined

Datamosh with Frame Manipulation

结合帧操控的数据杂糅

bash
undefined
bash
undefined

Datamosh by removing I-frames (requires re-encoding)

通过移除I帧实现数据杂糅(需重新编码)

ffmpeg -i input.mp4
-vf "minterpolate='mi_mode=mci:mc_mode=aobmc',
tblend=all_mode=difference:all_opacity=0.5"
datamosh_blend.mp4
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
undefined
ffmpeg -i input.mp4
-vf "minterpolate='mi_mode=mci:mc_mode=aobmc',lagfun=decay=0.9"
datamosh_trails.mp4
undefined

Controlled Datamosh (Specific Sections)

可控数据杂糅(特定片段)

bash
undefined
bash
undefined

Datamosh only certain section

仅对特定片段应用数据杂糅

ffmpeg -i input.mp4
-vf "minterpolate='mi_mode=mci:mc_mode=aobmc':enable='between(t,5,10)'"
controlled_datamosh.mp4
undefined
ffmpeg -i input.mp4
-vf "minterpolate='mi_mode=mci:mc_mode=aobmc':enable='between(t,5,10)'"
controlled_datamosh.mp4
undefined

Chromatic Aberration

色差效果

Color channel separation for that "broken lens" look.
通过分离颜色通道实现“镜头损坏”视觉效果。

rgbashift Filter

rgbashift滤镜

bash
undefined
bash
undefined

Horizontal chromatic aberration

水平色差

ffmpeg -i input.mp4
-vf "rgbashift=rh=-5:bh=5"
chromatic.mp4
ffmpeg -i input.mp4
-vf "rgbashift=rh=-5:bh=5"
chromatic.mp4

Parameters:

参数说明:

rh/rv: Red horizontal/vertical shift

rh/rv: 红色通道水平/垂直偏移

gh/gv: Green horizontal/vertical shift

gh/gv: 绿色通道水平/垂直偏移

bh/bv: Blue horizontal/vertical shift

bh/bv: 蓝色通道水平/垂直偏移

ah/av: Alpha horizontal/vertical shift

ah/av: Alpha通道水平/垂直偏移

Vertical chromatic aberration

垂直色差

ffmpeg -i input.mp4
-vf "rgbashift=rv=-3:bv=3"
chromatic_v.mp4
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
undefined
ffmpeg -i input.mp4
-vf "rgbashift=rh=-4:rv=-2:bh=4:bv=2"
chromatic_both.mp4
undefined

Animated Chromatic Aberration

动态色差

bash
undefined
bash
undefined

Pulsing chromatic aberration

脉冲式色差

ffmpeg -i input.mp4
-vf "rgbashift=rh='5sin(t3)':bh='-5sin(t3)'"
pulsing_chromatic.mp4
ffmpeg -i input.mp4
-vf "rgbashift=rh='5sin(t3)':bh='-5sin(t3)'"
pulsing_chromatic.mp4

Increasing aberration over time

随时间增强的色差

ffmpeg -i input.mp4
-vf "rgbashift=rh='-t2':bh='t2'"
increasing_chromatic.mp4
undefined
ffmpeg -i input.mp4
-vf "rgbashift=rh='-t2':bh='t2'"
increasing_chromatic.mp4
undefined

chromashift Filter (Chroma Only)

chromashift滤镜(仅调整色度)

bash
undefined
bash
undefined

Shift chroma channels (U/V in YUV)

偏移色度通道(YUV格式中的U/V通道)

ffmpeg -i input.mp4
-vf "chromashift=cbh=5:crh=-5"
chroma_shift.mp4
ffmpeg -i input.mp4
-vf "chromashift=cbh=5:crh=-5"
chroma_shift.mp4

cbh/cbv: Cb (blue-difference) horizontal/vertical

cbh/cbv: Cb(蓝色差值)通道水平/垂直偏移

crh/crv: Cr (red-difference) horizontal/vertical

crh/crv: Cr(红色差值)通道水平/垂直偏移

undefined
undefined

VHS/Analog Effects

VHS/模拟效果

Complete VHS Simulation

完整VHS模拟

bash
undefined
bash
undefined

Full VHS effect

完整VHS效果

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:c=black@0.3,
curves=preset=vintage"
-c:v libx264 -crf 20 vhs_effect.mp4
undefined
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:c=black@0.3,
curves=preset=vintage"
-c:v libx264 -crf 20 vhs_effect.mp4
undefined

VHS Components Breakdown

VHS效果组件拆解

bash
undefined
bash
undefined

1. VHS Noise (temporal noise)

1. VHS噪点(时域噪点)

ffmpeg -i input.mp4
-vf "noise=c0s=20:c0f=t:c1s=15:c1f=t"
vhs_noise.mp4
ffmpeg -i input.mp4
-vf "noise=c0s=20:c0f=t:c1s=15:c1f=t"
vhs_noise.mp4

2. VHS Color bleeding

2. VHS颜色溢出

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

3. VHS Scan lines

3. VHS扫描线

ffmpeg -i input.mp4
-vf "drawgrid=w=iw:h=2:t=1:c=black@0.4"
vhs_scanlines.mp4
ffmpeg -i input.mp4
-vf "drawgrid=w=iw:h=2:t=1:c=black@0.4"
vhs_scanlines.mp4

4. VHS Tracking issues (simulated)

4. VHS跟踪故障(模拟)

ffmpeg -i input.mp4
-vf "crop=iw:ih-20:0:'20*random(1)',pad=iw:ih+20:0:10"
vhs_tracking.mp4
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

5. VHS过饱和色彩

ffmpeg -i input.mp4
-vf "eq=saturation=1.5:contrast=1.1,curves=preset=vintage"
vhs_colors.mp4
undefined
ffmpeg -i input.mp4
-vf "eq=saturation=1.5:contrast=1.1,curves=preset=vintage"
vhs_colors.mp4
undefined

VHS Static/Snow

VHS雪花/静电效果

bash
undefined
bash
undefined

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
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
undefined
ffmpeg -i input.mp4 -i static.mp4
-filter_complex "[0:v][1:v]blend=all_mode=screen:all_opacity=0.1"
vhs_static.mp4
undefined

Pixelation & Mosaic

像素化与马赛克

Basic Pixelation

基础像素化

bash
undefined
bash
undefined

Pixelate entire video

全视频像素化

ffmpeg -i input.mp4
-vf "scale=iw/10:ih/10,scale=iw10:ih10:flags=neighbor"
pixelated.mp4
ffmpeg -i input.mp4
-vf "scale=iw/10:ih/10,scale=iw10:ih10: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=iw20:ih20:flags=neighbor"
heavy_pixel.mp4
undefined
ffmpeg -i input.mp4
-vf "scale=iw/20:ih/20,scale=iw20:ih20:flags=neighbor"
heavy_pixel.mp4
undefined

Animated Pixelation

动态像素化

bash
undefined
bash
undefined

Pixelation that increases over time

随时间增强的像素化

ffmpeg -i input.mp4
-vf "scale='iw/max(1,t2)':'ih/max(1,t2)',scale=iw:ih:flags=neighbor"
animated_pixel.mp4
ffmpeg -i input.mp4
-vf "scale='iw/max(1,t2)':'ih/max(1,t2)',scale=iw:ih:flags=neighbor"
animated_pixel.mp4

Note: This is approximate; true animated requires geq or external scripts

注意:该效果为近似实现;真正的动态像素化需使用geq或外部脚本

undefined
undefined

Mosaic/Censoring Effect

马赛克/模糊遮挡效果

bash
undefined
bash
undefined

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=iw10:ih10:flags=neighbor[blurred];
[0:v][blurred]overlay=300:200"
mosaic_region.mp4
undefined
ffmpeg -i input.mp4
-filter_complex "
[0:v]crop=200:200:300:200[face];
[face]scale=iw/10:ih/10,scale=iw10:ih10:flags=neighbor[blurred];
[0:v][blurred]overlay=300:200"
mosaic_region.mp4
undefined

Wave & Ripple Distortion

波浪与涟漪扭曲

Displacement Map

位移映射

bash
undefined
bash
undefined

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
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
undefined
ffmpeg -i input.mp4 -i displacement_h.png
-filter_complex "[0:v][1:v]displace=edge=wrap"
wave_h.mp4
undefined

Animated Wave with geq

使用geq实现动态波浪

bash
undefined
bash
undefined

Horizontal wave using geq

水平波浪

ffmpeg -i input.mp4
-vf "geq=lum='lum(X+10sin(Y/20+T5),Y)':cb='cb(X+10sin(Y/20+T5),Y)':cr='cr(X+10sin(Y/20+T5),Y)'"
wave_animated.mp4
ffmpeg -i input.mp4
-vf "geq=lum='lum(X+10sin(Y/20+T5),Y)':cb='cb(X+10sin(Y/20+T5),Y)':cr='cr(X+10sin(Y/20+T5),Y)'"
wave_animated.mp4

Vertical wave

垂直波浪

ffmpeg -i input.mp4
-vf "geq=lum='lum(X,Y+10sin(X/20+T5))':cb='cb(X,Y+10sin(X/20+T5))':cr='cr(X,Y+10sin(X/20+T5))'"
wave_v.mp4
ffmpeg -i input.mp4
-vf "geq=lum='lum(X,Y+10sin(X/20+T5))':cb='cb(X,Y+10sin(X/20+T5))':cr='cr(X,Y+10sin(X/20+T5))'"
wave_v.mp4

Ripple from center

中心涟漪

ffmpeg -i input.mp4
-vf "geq=lum='lum(X+5sin(sqrt(pow(X-W/2,2)+pow(Y-H/2,2))/10-T5),Y+5cos(sqrt(pow(X-W/2,2)+pow(Y-H/2,2))/10-T5))':cb='cb(X,Y)':cr='cr(X,Y)'"
ripple.mp4
undefined
ffmpeg -i input.mp4
-vf "geq=lum='lum(X+5sin(sqrt(pow(X-W/2,2)+pow(Y-H/2,2))/10-T5),Y+5cos(sqrt(pow(X-W/2,2)+pow(Y-H/2,2))/10-T5))':cb='cb(X,Y)':cr='cr(X,Y)'"
ripple.mp4
undefined

lenscorrection (Barrel/Pincushion)

lenscorrection(桶形/枕形畸变)

bash
undefined
bash
undefined

Barrel distortion (fisheye-like)

桶形畸变(鱼眼效果)

ffmpeg -i input.mp4
-vf "lenscorrection=cx=0.5:cy=0.5:k1=0.5:k2=0.5"
barrel.mp4
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
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)

cx, cy: 镜头中心(取值0-1,0.5为画面中心)

k1, k2: Distortion coefficients (positive = barrel, negative = pincushion)

k1, k2: 畸变系数(正数=桶形畸变,负数=枕形畸变)

undefined
undefined

Echo & Trails (lagfun)

回声与拖影(lagfun)

Basic Trails

基础拖影

bash
undefined
bash
undefined

Motion trails

运动拖影

ffmpeg -i input.mp4
-vf "lagfun=decay=0.95"
trails.mp4
ffmpeg -i input.mp4
-vf "lagfun=decay=0.95"
trails.mp4

Parameters:

参数说明:

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

decay: 拖影衰减速度(取值0-1,值越大拖影持续越久)

Heavy trails

重度拖影

ffmpeg -i input.mp4
-vf "lagfun=decay=0.98"
heavy_trails.mp4
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
undefined
ffmpeg -i input.mp4
-vf "lagfun=decay=0.85"
light_trails.mp4
undefined

Trails with Color

彩色拖影

bash
undefined
bash
undefined

Trails with color shift

带颜色偏移的拖影

ffmpeg -i input.mp4
-vf "lagfun=decay=0.95,hue=h=t*10"
color_trails.mp4
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
undefined
ffmpeg -i input.mp4
-vf "negate,lagfun=decay=0.95,negate"
inverted_trails.mp4
undefined

Frame Blending (tmix, tblend)

帧混合(tmix, tblend)

tmix (Temporal Mix)

tmix(时域混合)

bash
undefined
bash
undefined

Average 5 frames (motion blur effect)

平均5帧(运动模糊效果)

ffmpeg -i input.mp4
-vf "tmix=frames=5:weights='1 1 1 1 1'"
motion_blur.mp4
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
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
undefined
ffmpeg -i input.mp4
-vf "tmix=frames=3:weights='1 0.5 0.25'"
ghosting.mp4
undefined

tblend (Frame Difference)

tblend(帧差异)

bash
undefined
bash
undefined

Frame difference (motion highlight)

帧差异(突出运动区域)

ffmpeg -i input.mp4
-vf "tblend=all_mode=difference"
frame_diff.mp4
ffmpeg -i input.mp4
-vf "tblend=all_mode=difference"
frame_diff.mp4

Available modes:

可用模式:

addition, addition128, multiply, multiply128

addition, addition128, multiply, multiply128

average, difference, difference128

average, difference, difference128

divide, exclusion, extremity, freeze

divide, exclusion, extremity, freeze

glow, hardlight, hardmix, heat

glow, hardlight, hardmix, heat

lighten, darken, linearlight, negation

lighten, darken, linearlight, negation

normal, overlay, phoenix, pinlight

normal, overlay, phoenix, pinlight

reflect, screen, softdifference

reflect, screen, softdifference

softlight, stain, subtract, vividlight, xor

softlight, stain, subtract, vividlight, xor

undefined
undefined

Creative tblend Effects

创意tblend效果

bash
undefined
bash
undefined

Neon edges

霓虹边缘

ffmpeg -i input.mp4
-vf "tblend=all_mode=difference128,eq=brightness=0.1:contrast=2"
neon_edges.mp4
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
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
undefined
ffmpeg -i input.mp4
-vf "tblend=all_mode=heat"
burn_effect.mp4
undefined

Digital Corruption

数字损坏效果

Random Artifacts

随机伪影

bash
undefined
bash
undefined

Digital glitch noise

数字故障噪点

ffmpeg -i input.mp4
-vf "
noise=c0s=30:c0f=a+t:c1s=20:c1f=a+t,
rgbashift=rh='5random(1)':bh='-5random(1)'"
digital_glitch.mp4
ffmpeg -i input.mp4
-vf "
noise=c0s=30:c0f=a+t:c1s=20:c1f=a+t,
rgbashift=rh='5random(1)':bh='-5random(1)'"
digital_glitch.mp4

Note: random() generates noise, but isn't truly random between frames

注意:random()函数生成噪点,但帧与帧之间并非真正随机

undefined
undefined

Compression Artifact Simulation

压缩伪影模拟

bash
undefined
bash
undefined

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
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
undefined
for i in {1..5}; do ffmpeg -y -i input.mp4 -c:v libx264 -crf 40 temp.mp4 mv temp.mp4 input.mp4 done
undefined

Bit Manipulation (geq)

位操作(geq)

bash
undefined
bash
undefined

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
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

XOR图案

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

Scan Lines & CRT Effects

扫描线与CRT效果

Scan Lines

扫描线

bash
undefined
bash
undefined

Horizontal scan lines

水平扫描线

ffmpeg -i input.mp4
-vf "drawgrid=w=iw:h=2:t=1:c=black@0.5"
scanlines.mp4
ffmpeg -i input.mp4
-vf "drawgrid=w=iw:h=2:t=1:c=black@0.5"
scanlines.mp4

Heavier scan lines

更粗的扫描线

ffmpeg -i input.mp4
-vf "drawgrid=w=iw:h=4:t=2:c=black@0.7"
heavy_scanlines.mp4
ffmpeg -i input.mp4
-vf "drawgrid=w=iw:h=4:t=2:c=black@0.7"
heavy_scanlines.mp4

RGB scan lines (trinitron style)

RGB扫描线(特丽珑风格)

ffmpeg -i input.mp4
-vf "drawgrid=w=3:h=ih:t=1:c=black@0.3"
rgb_scanlines.mp4
undefined
ffmpeg -i input.mp4
-vf "drawgrid=w=3:h=ih:t=1:c=black@0.3"
rgb_scanlines.mp4
undefined

CRT Simulation

CRT模拟

bash
undefined
bash
undefined

Full CRT effect

完整CRT效果

ffmpeg -i input.mp4
-vf "
gblur=sigma=0.5,
drawgrid=w=iw:h=2:t=1:c=black@0.4,
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
undefined
ffmpeg -i input.mp4
-vf "
gblur=sigma=0.5,
drawgrid=w=iw:h=2:t=1:c=black@0.4,
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
undefined

Interlacing Effects

隔行扫描效果

bash
undefined
bash
undefined

Add interlacing artifacts

添加隔行扫描伪影

ffmpeg -i input.mp4
-vf "interlace=scan=tff,fieldorder=bff"
interlaced.mp4
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
undefined
ffmpeg -i input.mp4
-vf "tinterlace=merge"
comb_effect.mp4
undefined

Mirror & Kaleidoscope

镜像与万花筒

Mirror Effects

镜像效果

bash
undefined
bash
undefined

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
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
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
undefined
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
undefined

Combined Glitch Presets

组合故障预设

Music Video Glitch

音乐视频故障风格

bash
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
bash
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

Horror Glitch

恐怖故障风格

bash
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:c=black@0.5" \
  horror_glitch.mp4
bash
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:c=black@0.5" \
  horror_glitch.mp4

Cyberpunk Glitch

赛博朋克故障风格

bash
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:c=black@0.3,\
    unsharp=5:5:1.5" \
  cyberpunk.mp4
bash
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:c=black@0.3,\
    unsharp=5:5:1.5" \
  cyberpunk.mp4

Analog TV Signal Loss

模拟电视信号丢失

bash
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
bash
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

Performance Tips

性能优化建议

  1. geq is CPU-intensive - Use sparingly or on short clips
  2. minterpolate is slow - Consider reducing resolution first
  3. lagfun accumulates - May need periodic "reset" cuts
  4. Test on short clips before processing full videos
  5. Hardware encoding - Use NVENC/QSV for final encode after effects
bash
undefined
  1. geq滤镜CPU占用极高 - 谨慎使用或仅用于短视频片段
  2. minterpolate速度较慢 - 可考虑先降低分辨率再处理
  3. lagfun会累积画面 - 可能需要定期“重置”片段
  4. 先在短视频上测试,再处理完整视频
  5. 硬件编码 - 特效处理完成后,使用NVENC/QSV进行最终编码
bash
undefined

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

This guide covers FFmpeg glitch and distortion effects. For color grading see `ffmpeg-color-grading-chromakey`, for transitions see `ffmpeg-transitions-effects`.
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`。