Video Silence and Static Interval Detection and Merging Tool
A Go tool that detects intervals in videos where both "silence" and "static frame" conditions are met, and generates timeline files for use with auto-editor.
Performs intersection operations on two independent analysis results:
- auto-editor silence segments (
autoeditor.json) - Contains audio silence intervals - vcmp static frame segments (
.pb.zstfile) - Contains video static frame intervals (Protocol Buffers + Zstandard compression)
Output: Intervals that are both silent AND static, formatted as auto-editor v1 timeline JSON, ready for video editing.
- Automatically remove "frozen" segments from videos (static frame + no sound)
- Batch process invalid segments in video tutorials, screen recordings, and stream replays
- Precisely locate problem areas requiring manual editing
# Clone repository
git clone <repository-url>
cd gob2json
# Build and install to system path
make install-
Prepare Input Files
Place two files in your working directory:
autoeditor.json- Timeline file generated by auto-editor*.pb.zst- Video analysis result file generated by vcmp (Protocol Buffers + Zstandard compressed format, must contain suggested threshold data)
-
Run Program
gob2json [threshold] [minDuration] [output_base]
Parameter Description:
threshold(optional): Difference threshold (integer).- If omitted: Program automatically uses
SuggestedThresholdfrom.pb.zstfile - If provided: Overrides auto-suggested value and uses specified threshold
- If omitted: Program automatically uses
minDuration(optional): Minimum exclusion duration in seconds, must be positive, defaults to20.0seconds- Note: To specify
minDuration, you must explicitly provide thethresholdparameter
- Note: To specify
output_base(optional): Output file base name, defaults to input JSON filename
-
Use Output File
The program generates a timestamped JSON file, such as
autoeditor_20231215_143022.json, which can be used directly with auto-editor:auto-editor input.mp4 --edit timeline:autoeditor_20231215_143022.json
# Mode 1: Fully automatic
# Use suggested threshold from pb.zst file, default minimum exclusion duration 20 seconds
gob2json
# Mode 2: Manually specify threshold
# Force use threshold 30, default minimum exclusion duration 20 seconds
gob2json 30
# Mode 3: Specify threshold and duration
# Force use threshold 30, set minimum exclusion duration to 2.5 seconds
gob2json 30 2.5
# Mode 4: Specify output filename
gob2json 30 2.5 cleaned_outputโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ autoeditor.jsonโ โ analysis.pb.zstโ
โ (้้ณๅบ้ด) โ โ (้ๆญข็ป้ขๅบ้ด) โ
โโโโโโโโโโฌโโโโโโโโโ โโโโโโโโโโฌโโโโโโโโโ
โ โ
โโโโโโโโโโโโโฌโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโ
โ ไบค้่ฟ็ฎ โ
โ (้ๅ ๅบ้ดๆฃๆต) โ
โโโโโโโโโโฌโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโ
โ output_timestamp.json โ
โ (้้ณ+้ๆญข็ๅบ้ด) โ
โ ้ๅบฆๆ ่ฎฐไธบ 0.0 โ
โโโโโโโโโโโโโโโโโโโโโโโโโ
-
Parse Input Files
- Read frame difference data (
DiffCounts) and suggested threshold (SuggestedThreshold) from.pb.zstfile - Read timeline segments (
Chunks) fromautoeditor.json
- Read frame difference data (
-
Interval Detection
- Static frame intervals: Consecutive frames where difference value exceeds threshold (โฅ minimum duration)
- Silence intervals: Segments in timeline with speed
0.0or9999.0
-
Intersection Calculation
- Find overlapping parts of two interval sets
- Merge adjacent or overlapping intervals
-
Generate Output
- Set playback speed of intersection intervals to
0.0(exclusion marker) - Maintain original speed for other intervals
- Output JSON conforming to auto-editor v1 specification
- Set playback speed of intersection intervals to
gob2json/
โโโ main.go # Entry function, argument parsing and auto-threshold logic
โโโ vcmp.go # .pb.zst file I/O, AnalysisResult data structure definition
โโโ autoeditor.go # auto-editor JSON format parsing and generation
โโโ merge.go # Core algorithms: interval detection, intersection calculation, merge export
โโโ proto/ # Protocol Buffers definitions
โ โโโ analysis.proto
โโโ go.mod # Go module definition
โโโ Makefile # Build scripts
โโโ README.md # This document
# Build binary
make build
# Install to system path (requires sudo)
make install
# Uninstall
make uninstall
# Clean build files
make clean
# Display help information
make helpauto-editor JSON (v1):
{
"version": "1",
"source": "video.mp4",
"chunks": [
[0.0, 10.5, 1.0], // [start, end, speed]
[10.5, 15.0, 0.0], // speed 0.0 = silence segment
[15.0, 30.0, 1.0]
]
}vcmp .pb.zst file structure (Protocol Buffers):
syntax = "proto3";
package analysis;
message AnalysisResult {
string video_file = 1; // ่ขซๅๆ็่ง้ขๆไปถ่ทฏๅพ
double fps = 2; // ่ง้ขๅธง็
int32 width = 3; // ่ง้ขๅฎฝๅบฆ๏ผๅ็ด ๏ผ
int32 height = 4; // ่ง้ข้ซๅบฆ๏ผๅ็ด ๏ผ
int32 total_frames = 5; // ่ง้ขๆปๅธงๆฐ
double suggested_threshold = 6; // ่ชๅจ่ฎก็ฎ็ๅปบ่ฎฎ้ๅผ
repeated uint32 diff_counts = 7; // ๆฏไธๅธง็ๅทฎๅผๅ็ด ๆฐ้
}Files use Zstandard (zstd) compression to reduce storage space.
Same format as input auto-editor JSON, but intersection intervals have speed set to 0.0.
const (
MinExclusionDurationSeconds = 20.0 // Default minimum exclusion duration
ExcludedSpeedMarker = 0.0 // Exclusion region speed marker
SkipSpeedHigh = 9999.0 // High speed marker
SkipSpeedZero = 0.0 // Zero speed marker
)Program prioritizes command line arguments. If no command line arguments provided, attempts to use SuggestedThreshold stored in .pb.zst file. If both unavailable, program exits with error.
- Low threshold: More strict, may treat minor movements (like mouse jitter) as non-static
- High threshold: More lenient, tolerates certain frame changes
-
Input files not found
โ ๆชๆพๅฐ .pb.zst ๆไปถโ Ensure
.pb.zstand.jsonfiles exist in working directory -
Missing threshold
โ ็ผบๅฐ threshold ๅๆฐ๏ผไธๅๆ็ปๆไธญๆชๅ ๅซๆๆๅปบ่ฎฎ้ๅผโ The
.pb.zstfile does not contain suggested threshold. Must manually specify an integer threshold in command line (e.g.,gob2json 30) -
Multiple JSON files found
โ ๅ็ฐๅคไธช .json ๆไปถ๏ผไฝฟ็จ: autoeditor.jsonโ Program prioritizes file named
autoeditor.json -
Version error
โ ็ๆฌๅทๆ ๆ: ๆๆ "1"๏ผๅพๅฐ "3"โ Currently only supports auto-editor v1 format timeline
Issues and Pull Requests are welcome!
- Go 1.21 or higher
- Protocol Buffers compiler (protoc)
- Familiarity with auto-editor and vcmp tools
This project is open sourced under GPL-3.0 License.
- auto-editor - Automatic video editing tool
- vcmp - Video frame comparison tool