raw-video-processing

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Skill: Raw Video Processing

Skill:原始视频处理

Post-process raw screen recordings to improve pacing — remove silent segments, then speed up the result.
Prerequisite: FFmpeg and Python 3 must be installed.

对原始屏幕录制视频进行后期处理以优化节奏——移除静音片段,然后调整播放速度。
前提条件:必须安装FFmpeg和Python 3。

When to Use

适用场景

The user has recorded a screencast and wants to clean it up before publishing. Typical issues in raw recordings:
  • Long pauses / dead air while thinking or waiting for loading
  • Overall pacing feels slow and could benefit from a slight speed boost

用户录制了屏幕视频,希望在发布前进行优化。原始录制视频的常见问题:
  • 思考或等待加载时的长时间停顿/无声时段
  • 整体节奏偏慢,小幅提升播放速度会更合适

Default Workflow

默认工作流程

When the user provides a raw video file, run both scripts in sequence by default:
当用户提供原始视频文件时,默认按顺序运行两个脚本

Step 1: Remove Silent Segments

步骤1:移除静音片段

bash
python /path/to/skills/raw-video-processing/scripts/remove_silence.py <input.mp4>
This detects and cuts out silent portions, producing
<input>_nosilence.mp4
.
Default parameters (good for most screencasts):
  • --threshold -30dB
    — silence detection sensitivity
  • --duration 0.8
    — minimum silence length (seconds) to remove
  • --padding 0.2
    — seconds of breathing room kept around speech boundaries
The script prints a detailed summary: number of silent segments found, total silence removed, and all kept segments with timestamps. Review this output to confirm the result looks reasonable.
bash
python /path/to/skills/raw-video-processing/scripts/remove_silence.py <input.mp4>
该脚本会检测并剪切掉静音部分,生成
<input>_nosilence.mp4
文件。
默认参数(适用于大多数屏幕录制视频):
  • --threshold -30dB
    — 静音检测灵敏度
  • --duration 0.8
    — 需移除的最短静音时长(秒)
  • --padding 0.2
    — 保留语音片段前后的缓冲时长(秒)
脚本会输出详细摘要:检测到的静音片段数量、移除的总静音时长,以及所有保留片段的时间戳。可查看该输出确认处理结果是否合理。

Step 2: Speed Up the Video

步骤2:调整视频播放速度

bash
python /path/to/skills/raw-video-processing/scripts/speed_video.py <input>_nosilence.mp4
This applies a speed multiplier to the silence-removed video, producing
<input>_nosilence_1.2x.mp4
.
Default parameters:
  • --speed 1.2
    — 1.2x playback speed (a subtle boost that doesn't feel rushed)

bash
python /path/to/skills/raw-video-processing/scripts/speed_video.py <input>_nosilence.mp4
该脚本会为已移除静音的视频应用速度乘数,生成
<input>_nosilence_1.2x.mp4
文件。
默认参数
  • --speed 1.2
    — 1.2倍播放速度(小幅提升,不会显得仓促)

Script Options

脚本选项

remove_silence.py

remove_silence.py

FlagDefaultDescription
-o
,
--output
<input>_nosilence.mp4
Custom output path
-t
,
--threshold
-30dB
Silence threshold in dB (lower = more sensitive)
-d
,
--duration
0.8
Minimum silence duration in seconds to remove
-p
,
--padding
0.2
Padding kept around non-silent segments
--dry-run
offOnly print detected segments, don't export
标识默认值描述
-o
,
--output
<input>_nosilence.mp4
自定义输出路径
-t
,
--threshold
-30dB
静音阈值(单位:dB,数值越低灵敏度越高)
-d
,
--duration
0.8
需移除的最短静音时长(秒)
-p
,
--padding
0.2
保留在非静音片段前后的缓冲时长
--dry-run
关闭仅输出检测到的片段,不生成文件

speed_video.py

speed_video.py

FlagDefaultDescription
-o
,
--output
<input>_<speed>x.mp4
Custom output path
-s
,
--speed
1.2
Playback speed multiplier

标识默认值描述
-o
,
--output
<input>_<speed>x.mp4
自定义输出路径
-s
,
--speed
1.2
播放速度乘数

Custom Scenarios

自定义场景

  • Only remove silence — run just Step 1.
  • Only speed up — run just Step 2 directly on the input file.
  • Aggressive cleanup — use
    --threshold -25dB --duration 0.5
    for stricter silence removal, and
    --speed 1.5
    for faster playback.
  • Preview before committing — use
    --dry-run
    on remove_silence.py to see what would be cut without creating a file.
  • Custom output name — use
    -o
    on either script to control the output path.

  • 仅移除静音片段 — 仅运行步骤1。
  • 仅调整播放速度 — 直接对输入文件运行步骤2。
  • 深度优化 — 使用
    --threshold -25dB --duration 0.5
    来更严格地移除静音片段,同时设置
    --speed 1.5
    实现更快的播放速度。
  • 预览处理效果 — 在remove_silence.py中使用
    --dry-run
    参数,查看将被剪切的内容而无需生成文件。
  • 自定义输出文件名 — 在任一脚本中使用
    -o
    参数指定输出路径。

Important Notes

重要说明

  • Always run remove_silence before speed_video. Silence detection works on the original audio; speeding up first would alter the audio characteristics and make silence detection less accurate.
  • For long videos (>30 min), the silence removal step may take a few minutes as it processes each segment individually.
  • Both scripts preserve video quality — remove_silence uses stream copy (no re-encoding), while speed_video re-encodes with FFmpeg defaults.
  • 务必先运行remove_silence,再运行speed_video。静音检测基于原始音频;若先调整速度,会改变音频特征,降低静音检测的准确性。
  • 对于长视频(超过30分钟),移除静音片段的步骤可能需要几分钟,因为脚本会逐个处理每个片段。
  • 两个脚本均会保留视频质量——remove_silence采用流复制(无重新编码),而speed_video使用FFmpeg默认设置重新编码。