关于 ffmpeg-deinterlacing-telecine
这是一份面向视频编辑和开发人员的 FFmpeg 技能指南,适用于处理隔行或 Telecine 视频。内容涵盖检测、去隔行滤镜、场处理、硬件选项和逆 Telecine 工作流。
主要功能
- 01使用 idet 检测隔行
- 02比较 yadif、bwdif 和 w3fdif
- 03使用 CUDA、Vulkan、VAAPI 和 QSV 滤镜
- 04通过 pullup 或 fieldmatch 去除 Telecine
- 05校正和处理场序
适用场景
- 01将广播视频转换为逐行视频
- 02处理 DVD 或 Blu-ray 素材
- 03数字化旧式隔行视频
- 04去除电影内容的 3:2 下拉
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ josiahsiegel/ claude-plugin-marketplace --skill ffmpeg-deinterlacing-telecine安装后在 Claude Code 中输入/ffmpeg-deinterlacing-telecine确认已加载。
详细介绍
关键指南
Windows 文件路径要求
强制要求:在 Windows 上始终使用反斜杠表示文件路径
在 Windows 上使用 Edit 或 Write 工具时,文件路径必须使用反斜杠(\),不得使用正斜杠(/)。
快速参考
| 任务 | 滤镜 | 命令模式 |
|---|---|---|
| 基本去隔行 | yadif | -vf yadif |
| 高质量去隔行 | bwdif | -vf bwdif |
| CUDA 去隔行 | yadif_cuda | -vf yadif_cuda |
| 逆电视电影 | pullup | -vf pullup |
| 场序 | fieldorder | -vf fieldorder=tff |
| 检测隔行 | idet | -vf idet |
何时使用此技能
适用于隔行和电视电影内容:
- 将广播/电视内容转换为逐行格式
- DVD 和 Blu-ray 处理
- 旧版视频数字化
- 专业视频制作
- 场序校正
- 去除电视电影效果(3:2 下拉)
FFmpeg 去隔行与电视电影处理(2025)
去隔行、场处理和电视电影去除的综合指南。
了解隔行视频
什么是隔行扫描?
隔行视频每帧存储两个半分辨率场:
- 顶场(TFF):奇数行(1、3、5、...)
- 底场(BFF):偶数行(2、4、6、...)
常见隔行格式:
- 1080i(1920x1080,50i 或 60i)
- 576i(720x576,50i - PAL)
- 480i(720x480,60i - NTSC)
检测隔行内容
# Use idet filter to detect interlacing
ffmpeg -i input.mp4 -vf "idet" -frames:v 500 -f null -
# Output shows field types:
# TFF = Top Field First
# BFF = Bottom Field First
# Progressive = Not interlaced
# Undetermined = Mixed or uncertain
去隔行滤镜
yadif - 另一种去隔行滤镜
这是使用最广泛的去隔行滤镜,兼顾速度和质量。
# Basic deinterlacing (output same frame rate)
ffmpeg -i interlaced.mp4 -vf "yadif" output.mp4
# Double frame rate (output both fields as frames)
ffmpeg -i interlaced.mp4 -vf "yadif=1" output.mp4
# Specify field parity (auto-detect by default)
ffmpeg -i interlaced.mp4 -vf "yadif=0:0:0" output.mp4 # TFF
ffmpeg -i interlaced.mp4 -vf "yadif=0:1:0" output.mp4 # BFF
# Only deinterlace if detected as interlaced
ffmpeg -i input.mp4 -vf "yadif=deint=interlaced" output.mp4
参数:
| 参数 | 描述 | 值 |
|---|---|---|
mode | 输出模式 | 0=相同帧率,1=双倍帧率 |
parity | 场奇偶性 | -1=自动,0=TFF,1=BFF |
deint | 去隔行的帧 | 0=全部,1=仅隔行帧 |
模式选项:
0/send_frame- 每个输入帧输出一帧1/send_field- 每个场输出一帧(双倍帧率)2/send_frame_nospatial- 类似 0,但不进行空间隔行检查3/send_field_nospatial- 类似 1,但不进行空间隔行检查
bwdif - Bob Weaver 去隔行滤镜
质量高于 yadif,使用更多帧进行插值。
# Basic bwdif
ffmpeg -i interlaced.mp4 -vf "bwdif" output.mp4
# Double frame rate
ffmpeg -i interlaced.mp4 -vf "bwdif=1" output.mp4
# Specify parity
ffmpeg -i interlaced.mp4 -vf "bwdif=0:-1:1" output.mp4
**参数:**与 yadif 相同
w3fdif - Martin Weston 三场去隔行
使用三个场进行插值,获得更高质量。
# Simple filter (faster)
ffmpeg -i interlaced.mp4 -vf "w3fdif=filter=simple" output.mp4
# Complex filter (better quality)
ffmpeg -i interlaced.mp4 -vf "w3fdif=filter=complex" output.mp4
参数:
| 参数 | 描述 | 值 |
|---|---|---|
filter | 滤波器系数 | simple、complex |
deint | 去隔行的帧 | all、interlaced |
kerndeint - 内核去隔行
基于自适应内核的去隔行。
# Basic kerndeint
ffmpeg -i interlaced.mp4 -vf "kerndeint" output.mp4
# With threshold adjustment
ffmpeg -i interlaced.mp4 -vf "kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0" output.mp4
硬件加速去隔行
yadif_cuda - NVIDIA CUDA
# Full GPU pipeline with CUDA deinterlacing
ffmpeg -hwaccel cuda -hwaccel_output_format cuda \
-i interlaced.mp4 \
-vf "yadif_cuda=0:-1:0" \
-c:v h264_nvenc output.mp4
# Double framerate with CUDA
ffmpeg -hwaccel cuda -hwaccel_output_format cuda \
-i interlaced.mp4 \
-vf "yadif_cuda=1" \
-c:v h264_nvenc output.mp4
bwdif_cuda - NVIDIA CUDA(FFmpeg 7.0+)
# Higher quality CUDA deinterlacing
ffmpeg -hwaccel cuda -hwaccel_output_format cuda \
-i interlaced.mp4 \
-vf "bwdif_cuda" \
-c:v h264_nvenc output.mp4
bwdif_vulkan - Vulkan(FFmpeg 8.0+)
跨平台 GPU 去隔行。
# Vulkan deinterlacing (works on AMD, Intel, NVIDIA)
ffmpeg -init_hw_device vulkan \
-hwaccel vulkan -hwaccel_output_format vulkan \
-i interlaced.mp4 \
-vf "bwdif_vulkan" \
-c:v h264_vulkan output.mp4
deinterlace_vaapi - VAAPI(Linux)
# VAAPI deinterlacing
ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 \
-hwaccel_output_format vaapi \
-i interlaced.mp4 \
-vf "deinterlace_vaapi" \
-c:v h264_vaapi output.mp4
# Specify deinterlace mode
ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 \
-hwaccel_output_format vaapi \
-i interlaced.mp4 \
-vf "deinterlace_vaapi=mode=motion_adaptive:rate=frame" \
-c:v h264_vaapi output.mp4
VAAPI 去隔行模式:
default- 使用驱动默认设置bob- 简单 bob(双倍速率)weave- 将场编织在一起motion_adaptive- 运动自适应(质量最佳)motion_compensated- 运动补偿(质量最高)
deinterlace_qsv - Intel QSV
# QSV deinterlacing
ffmpeg -hwaccel qsv -hwaccel_output_format qsv \
-i interlaced.mp4 \
-vf "vpp_qsv=deinterlace=2" \
-c:v h264_qsv output.mp4
VPP_QSV 去隔行模式:
0- 关闭1- Bob2- 高级(运动自适应)
逆电视电影(IVTC)
了解电视电影(3:2 下拉)
电视电影通过复制场,将 24fps 胶片转换为 30fps 视频:
Film: A B C D
Video: AA AB BB BC CC CD DD DA
pullup - Pullup 滤镜
通过检测并去除重复场来去除 3:2 电视电影效果。
# Basic IVTC
ffmpeg -i telecined.mp4 -vf "pullup" -r 24000/1001 output.mp4
# With metric output
ffmpeg -i telecined.mp4 -vf "pullup=mp=y" -r 24000/1001 output.mp4
参数:
| 参数 | 描述 | 值 |
|---|---|---|
jl、jr | 左侧/右侧无效像素 | 1-宽度 |
jt、jb | 顶部/底部无效像素 | 1-高度 |
sb | 严格断点 | 0 或 1 |
mp | 度量平面 | y、u、v |
fieldmatch - 场匹配
通过场匹配实现更高级的电视电影去除。
# Basic field matching
ffmpeg -i telecined.mp4 -vf "fieldmatch" output.mp4
# Full IVTC pipeline with decimation
ffmpeg -i telecined.mp4 -vf "fieldmatch,decimate" output.mp4
# Specify field order
ffmpeg -i telecined.mp4 -vf "fieldmatch=order=tff,decimate" output.mp4
组合式 IVTC 工作流:
# Complete telecine removal pipeline
ffmpeg -i telecined.mp4 \
-vf "fieldmatch=order=auto:combmatch=full,decimate" \
-r 24000/1001 \
output.mp4
decimate - 帧抽取
移除重复帧(在 fieldmatch 后使用)。
# Remove every 5th frame (30->24 fps)
ffmpeg -i input.mp4 -vf "decimate=cycle=5" output.mp4
# Detect duplicates
ffmpeg -i input.mp4 -vf "decimate=cycle=5:ppsrc=1" output.mp4
场处理
fieldorder - 更改场顺序
在 TFF 和 BFF 之间转换场顺序。
# Convert BFF to TFF
ffmpeg -i bff_input.mp4 -vf "fieldorder=tff" output.mp4
# Convert TFF to BFF
ffmpeg -i tff_input.mp4 -vf "fieldorder=bff" output.mp4
separatefields - 分离场
将每帧拆分为两个场。
# Separate fields (doubles frame count, halves height)
ffmpeg -i interlaced.mp4 -vf "separatefields" output.mp4
weave - 交织场
将两个连续帧合并为一个隔行扫描帧。
# Weave fields (opposite of separatefields)
ffmpeg -i progressive.mp4 -vf "weave" interlaced.mp4
# Specify first field
ffmpeg -i progressive.mp4 -vf "weave=first_field=top" interlaced.mp4
tinterlace - 时域隔行扫描
从逐行内容创建隔行扫描输出,或修改隔行扫描内容。
# Create interlaced from progressive (merge adjacent frames)
ffmpeg -i progressive.mp4 -vf "tinterlace=merge" interlaced.mp4
# Bob deinterlace (simple doubling)
ffmpeg -i interlaced.mp4 -vf "tinterlace=4" bobbed.mp4
# Create interlaced at half frame rate
ffmpeg -i progressive.mp4 -vf "tinterlace=interleave_top" interlaced.mp4
模式:
| 模式 | 描述 |
|---|---|
merge / 0 | 合并连续帧中的场 |
drop_even / 1 | 丢弃偶数帧,交织其余帧 |
drop_odd / 2 | 丢弃奇数帧,交织其余帧 |
pad / 3 | 用黑色填充交替的行 |
interleave_top / 4 | 交织,TFF |
interleave_bottom / 5 | 交织,BFF |
interlacex2 / 6 | 双倍速率隔行扫描 |
mergex2 / 7 | 双倍速率场合并 |
il - 交织/反交织行
底层行交织。
# Swap luma and chroma lines
ffmpeg -i input.mp4 -vf "il=l=s:c=s" output.mp4
常见工作流
DVD 转逐行 MP4
# Step 1: Detect interlacing
ffmpeg -i dvd_rip.vob -vf "idet" -frames:v 500 -f null -
# Step 2: Deinterlace (if interlaced)
ffmpeg -i dvd_rip.vob \
-vf "yadif=1:-1:1" \
-c:v libx264 -crf 18 \
-c:a aac -b:a 192k \
output.mp4
# For telecined content (film-based DVDs):
ffmpeg -i dvd_rip.vob \
-vf "fieldmatch,decimate" \
-r 24000/1001 \
-c:v libx264 -crf 18 \
output.mp4
广播 1080i 转 1080p
# High quality deinterlacing
ffmpeg -i broadcast_1080i.ts \
-vf "bwdif=1:-1:0" \
-c:v libx264 -crf 18 -preset slow \
-c:a copy \
output_1080p.mp4
# With GPU acceleration
ffmpeg -hwaccel cuda -hwaccel_output_format cuda \
-i broadcast_1080i.ts \
-vf "bwdif_cuda=1" \
-c:v h264_nvenc -preset p4 \
-c:a copy \
output_1080p.mp4
混合内容检测与处理
#!/bin/bash
# Detect and process based on content type
INPUT="$1"
# Detect interlacing type
result=$(ffmpeg -i "$INPUT" -vf "idet" -frames:v 1000 -f null - 2>&1)
if echo "$result" | grep -q "Multi.*[1-9]"; then
echo "Interlaced content detected - applying bwdif"
ffmpeg -i "$INPUT" -vf "bwdif" -c:v libx264 -crf 18 output.mp4
elif echo "$result" | grep -q "Repeated.*[1-9]"; then
echo "Telecined content detected - applying IVTC"
ffmpeg -i "$INPUT" -vf "fieldmatch,decimate" -c:v libx264 -crf 18 output.mp4
else
echo "Progressive content - no deinterlacing needed"
ffmpeg -i "$INPUT" -c:v libx264 -crf 18 output.mp4
fi
质量比较
| 滤镜 | 质量 | 速度 | 最适用场景 |
|---|---|---|---|
yadif | 良好 | 快 | 通用用途 |
bwdif | 更好 | 中等 | 注重质量 |
w3fdif | 最佳 | 慢 | 关键任务 |
yadif_cuda | 良好 | 非常快 | GPU 系统 |
bwdif_cuda | 更好 | 快 | GPU 系统 |
deinterlace_vaapi | 良好 | 非常快 | Linux/VAAPI |
最佳实践
- 先检测 - 使用
idet确定内容类型 - 保留帧率 - 同帧率使用模式 0,双倍帧率使用模式 1
- 匹配场顺序 - 使用自动检测或指定正确的奇偶场
- 有可用 GPU 时使用 GPU - CUDA/VAAPI 滤镜速度快得多
- 胶片内容使用 IVTC - 不要对经过电视电影转换的胶片执行去隔行扫描,应使用 pullup/fieldmatch
- 在样片上测试 - 处理完整视频前,检查一段短片
本指南介绍了 2025 年的去隔行扫描和电视电影转换。有关硬件加速的详细信息,请参阅 ffmpeg-hardware-acceleration。有关视频分析,请参阅 ffmpeg-video-analysis。
评论
支持 Markdown