Hit the Road Dude 片段是否以靜音開始或結束?首段語音何時開始?
Does This Hit the Road Dude Clip Start or End With Silence, and How Long Is the First Spoken Beat?
文章以自製的 15 秒合成 9:16 片段,量度 Hit the Road Dude 重製影片的開頭靜音、結尾靜音及首段語音起點。檢查器以 10 ms RMS hop、−40 dBFS 門檻及連續兩個 hop 確認起音,並與 ffmpeg silencedetect 的 50 ms 最短靜音設定比較;兩種方法的結果可能不同,AAC 尾端填充亦會影響結尾靜音測量。
A 15-second Hit the Road Dude remake is already a tight clock: four lines, a pause, and a point down the road. If the file starts with a long pad, or if the last line dies out a second early, that clock is not the clock you paid for. I wanted a measurement of leading silence, trailing silence, and the onset of the first spoken beat, from the samples rather than from a listen.
This is a measurement on synthetic 9:16 clips. I did not use a paid studio render. The product, for context, is a 15-second 9:16 remake with a newly generated voice at hittheroaddude.app. As of 23 November 2026, a single run is $9.99 at 480p or $12.99 at 720p. The check below is on the audio track of files I built myself.
I built the files with ffmpeg 7.1.5 and read them with a small Python checker plus ffmpeg silencedetect. The useful numbers are not interchangeable. A 10 ms RMS hop will quantize a designed 0.800 s pad to a nearby hop. silencedetect with a 50 ms minimum duration will miss a 40 ms tight lead-in. AAC adds a little duration at the end of the file, and that padding shows up as trailing silence if you measure to the decoded EOF.
The test files
The maker is make_silence_test_clips.py (published next to this post). It writes four 720x1280 files, 15 seconds, 30 fps, AAC at 48 kHz unless noted:
-
tight_control.mp4— designed 0.040 s of leading digital silence, then a 220 Hz tone (a spoken-beat stand-in) to the end. -
leading_0800.mp4— designed 0.800 s of leading digital silence, then the tone to the end. -
trailing_1250.mp4— the tone from t = 0 to t = 13.750 s, then designed 1.250 s of trailing digital silence. -
social_leading.mp4— a second H.264/AAC pass ofleading_0800.mp4as a social-share stand-in: CRF 28, High profile, 44.1 kHz AAC,+faststart.
$ python3 make_silence_test_clips.py
wrote tight_control.mp4, leading_0800.mp4, trailing_1250.mp4, social_leading.mp4
The checker
The script decodes the audio to mono float32, builds a 10 ms RMS envelope with a 20 ms window, and calls a hop active when it is above −40.0 dBFS. Two consecutive hops (20 ms) confirm the first spoken-beat onset. Trailing silence is measured from the end of the last confirmed active hop to the decoded duration. The same file is also run through silencedetect=noise=-40dB:d=0.05. I am quoting both. They do not always agree, and that disagreement is the point of having both.
#!/usr/bin/env python3
"""Measure leading/trailing silence and the first spoken-beat onset.
Reports both a Python RMS envelope (10 ms hops, threshold -40 dBFS,
two consecutive hops to confirm) and ffmpeg silencedetect
(noise=-40dB, d=0.05). Prints designed-vs-measured seconds.
Usage:
python3 silence_check.py [clip.mp4 ...]
"""
from __future__ import annotations
import argparse
import json
import subprocess
import sys
from pathlib import Path
import numpy as np
THRESH_DB = -40.0
HOP_S = 0.010
MIN_RUN_HOPS = 2 # 20 ms confirmation
def db_from_rms(rms: float) -> float:
if rms <= 0:
return float("-inf")
return 20.0 * np.log10(rms)
def decode_mono(path: Path) -> tuple[np.ndarray, int]:
probe = subprocess.check_output(
[
"ffprobe", "-hide_banner", "-loglevel", "error",
"-select_streams", "a:0",
"-show_entries", "stream=sample_rate,channels",
"-of", "json",
str(path),
],
text=True,
)
stream = json.loads(probe)["streams"][0]
sr = int(stream["sample_rate"])
ch = int(stream.get("channels") or 1)
raw = subprocess.check_output(
[
"ffmpeg", "-hide_banner", "-loglevel", "error",
"-i", str(path),
"-vn", "-ac", "1", "-f", "f32le", "-acodec", "pcm_f32le",
"pipe:1",
]
)
samples = np.frombuffer(raw, dtype=np.float32)
return samples, sr
def rms_envelope(samples: np.ndarray, sr: int, hop_s: float = HOP_S) -> tuple[np.ndarray, np.ndarray]:
hop = max(1, int(round(sr * hop_s)))
n = len(samples)
# Use a 20 ms window centered-ish on each hop for a slightly smoother RMS.
win = max(hop, int(round(sr * 0.020)))
starts = np.arange(0, n, hop)
rms = np.empty(len(starts), dtype=np.float64)
for i, s0 in enumerate(starts):
chunk = samples[s0 : min(n, s0 + win)]
rms[i] = float(np.sqrt(np.mean(np.square(chunk, dtype=np.float64)))) if len(chunk) else 0.0
times = starts / sr
return times, rms
def first_active_index(active: np.ndarray, min_run: int) -> int | None:
run = 0
for i, flag in enumerate(active):
if flag:
run += 1
if run >= min_run:
return i - min_run + 1
else:
run = 0
return None
def last_active_end(active: np.ndarray, min_run: int) -> int | None:
"""Index of the last hop that is part of a confirmed active run (inclusive)."""
run = 0
last_end = None
run_start = None
for i, flag in enumerate(active):
if flag:
if run == 0:
run_start = i
run += 1
else:
if run >= min_run:
last_end = i - 1
run = 0
run_start = None
if run >= min_run:
last_end = len(active) - 1
return last_end
def python_silence(samples: np.ndarray, sr: int) -> dict:
times, rms = rms_envelope(samples, sr)
db = np.array([db_from_rms(x) for x in rms], dtype=np.float64)
active = db > THRESH_DB
duration = len(samples) / sr
onset_i = first_active_index(active, MIN_RUN_HOPS)
last_i = last_active_end(active, MIN_RUN_HOPS)
leading = float(times[onset_i]) if onset_i is not None else float(duration)
if last_i is None:
trailing = float(duration)
last_t = None
else:
# Trailing silence starts after the last active hop's window.
hop = max(1, int(round(sr * HOP_S)))
last_sample = min(len(samples), int(round(times[last_i] * sr)) + hop)
last_t = last_sample / sr
trailing = max(0.0, duration - last_t)
return {
"duration_s": duration,
"n_samples": int(len(samples)),
"sample_rate": sr,
"leading_s": leading,
"first_onset_s": leading if onset_i is not None else None,
"last_activity_s": last_t,
"trailing_s": trailing,
"peak_rms_db": float(np.max(db[np.isfinite(db)])) if np.any(np.isfinite(db)) else float("-inf"),
"n_hops": int(len(times)),
"n_active_hops": int(np.sum(active)),
}
def silencedetect(path: Path, noise_db: float = THRESH_DB, d: float = 0.05) -> dict:
proc = subprocess.run(
[
"ffmpeg", "-hide_banner",
"-i", str(path),
"-af", f"silencedetect=noise={noise_db}dB:d={d}",
"-f", "null", "-",
],
capture_output=True,
text=True,
)
stderr = proc.stderr
starts: list[float] = []
ends: list[float] = []
durs: list[float] = []
for line in stderr.splitlines():
if "silence_start:" in line:
starts.append(float(line.split("silence_start:")[1].split()[0]))
elif "silence_end:" in line:
# silence_end: 0.812345 | silence_duration: 0.812345
parts = line.split("silence_end:")[1]
end_s = float(parts.split("|")[0].strip())
ends.append(end_s)
if "silence_duration:" in parts:
durs.append(float(parts.split("silence_duration:")[1].split()[0]))
else:
durs.append(float("nan"))
return {
"silence_starts": starts,
"silence_ends": ends,
"silence_durations": durs,
"raw_lines": [ln.strip() for ln in stderr.splitlines() if "silence_" in ln],
}
def format_report(path: Path) -> str:
samples, sr = decode_mono(path)
py = python_silence(samples, sr)
ff = silencedetect(path)
lines = [f"== {path.name} =="]
lines.append(
f"decoded {py['n_samples']} samples at {py['sample_rate']} Hz, "
f"duration {py['duration_s']:.6f} s"
)
lines.append(f"RMS threshold {THRESH_DB:.1f} dBFS, hop {HOP_S*1000:.0f} ms, confirm {MIN_RUN_HOPS} hops")
lines.append(f"Python leading silence: {py['leading_s']:.6f} s")
onset = py["first_onset_s"]
lines.append(
"Python first spoken-beat onset: "
+ (f"{onset:.6f} s" if onset is not None else "none")
)
last_t = py["last_activity_s"]
lines.append(
"Python last activity end: "
+ (f"{last_t:.6f} s" if last_t is not None else "none")
)
lines.append(f"Python trailing silence: {py['trailing_s']:.6f} s")
lines.append(f"Python peak RMS: {py['peak_rms_db']:.6f} dBFS")
lines.append(f"Python active hops: {py['n_active_hops']} / {py['n_hops']}")
if ff["raw_lines"]:
lines.append("ffmpeg silencedetect:")
for ln in ff["raw_lines"]:
lines.append(f" {ln}")
else:
lines.append("ffmpeg silencedetect: (no events)")
# Convenience: leading/trailing from silencedetect if present.
starts, ends, durs = ff["silence_starts"], ff["silence_ends"], ff["silence_durations"]
if starts and starts[0] <= 0.000001:
# leading silence duration is either the first duration or first end
lead = durs[0] if durs else (ends[0] if ends else float("nan"))
lines.append(f"ffmpeg leading silence: {lead:.6f} s (start {starts[0]:.6f})")
elif not starts:
lines.append("ffmpeg leading silence: none reported")
else:
lines.append(f"ffmpeg first silence starts at {starts[0]:.6f} s (not at t=0)")
if starts:
last_start = starts[-1]
if last_start > 0:
lines.append(f"ffmpeg last silence_start: {last_start:.6f} s")
if len(ends) >= len(starts):
lines.append(f"ffmpeg last silence_end: {ends[-1]:.6f} s, duration {durs[-1]:.6f} s")
else:
lines.append("ffmpeg last silence had no silence_end (runs to EOF)")
lines.append("")
return "\n".join(lines)
def main() -> int:
p = argparse.ArgumentParser()
p.add_argument("clips", nargs="+", type=Path)
args = p.parse_args()
for clip in args.clips:
sys.stdout.write(format_report(clip))
return 0
if __name__ == "__main__":
raise SystemExit(main())
What I measured
Every AAC file on this box decoded slightly longer than 15.000000 s. The 48 kHz files were 720,896 samples / 15.018667 s. The 44.1 kHz social re-encode was 662,528 samples / 15.023311 s. That extra is encoder padding, not part of the designed pad.
tight_control.mp4. Python leading silence and first spoken-beat onset: 0.030000 s. Last activity end: 15.000000 s. Trailing silence: 0.018667 s (the AAC pad). Peak RMS: −20.992126 dBFS. Active hops: 1,497 / 1,502. ffmpeg silencedetect at d=0.05 reported no events — the designed 40 ms lead-in is shorter than that minimum. I also ran d=0.02 on this file only, as a check, and it printed silence_start: 0, silence_end: 0.0400625, silence_duration: 0.0400625. The Python hop (30 ms) and the shorter silencedetect (40.0625 ms) are on either side of the designed 0.040 s. The default 50 ms detector missed it entirely.
leading_0800.mp4. Python leading silence and first spoken-beat onset: 0.790000 s. Last activity end: 15.000000 s. Trailing silence: 0.018667 s. Peak RMS: −20.992126 dBFS. Active hops: 1,421 / 1,502. ffmpeg silencedetect at d=0.05 printed silence_start: 0, silence_end: 0.800063, silence_duration: 0.800063. The hop grid rounded the onset 10 ms early; silencedetect landed 0.000063 s after the designed 0.800 s.
trailing_1250.mp4. Python leading silence and first spoken-beat onset: 0.000000 s. Last activity end: 13.750000 s. Trailing silence: 1.268667 s. Peak RMS: −20.303863 dBFS. Active hops: 1,375 / 1,502. ffmpeg printed silence_start: 13.749958, silence_end: 15.018667, silence_duration: 1.268708. The designed trailing pad was 1.250 s in a 15.000 s file. Measured against the decoded 15.018667 s duration, both tools report about 1.2687 s. The extra 0.018667 s is the same AAC pad that showed up as trailing silence on the files that were designed to run to the end.
social_leading.mp4. Python leading silence and first spoken-beat onset: 0.790000 s. Last activity end: 15.000000 s. Trailing silence: 0.023311 s. Peak RMS: −20.982407 dBFS. Active hops: 1,421 / 1,503. ffmpeg printed silence_start: 0, silence_end: 0.800068, silence_duration: 0.800068. A second encode at 44.1 kHz did not move the Python onset, and it moved silencedetect by 0.000005 s relative to the 48 kHz original. I am not going to claim that every social re-share preserves an 0.800 s pad this closely; this is what this re-encode did.
How I would read a real clip
If the first spoken beat should land on the off-camera "I thought it was state property" line, a leading pad of 0.800 s is already a lot of the 15-second budget. A trailing pad of 1.25 s after "Hit the road, dude" is a different problem: the send-off is early, and the file still has a second of digital quiet. The hop method is a good yes-or-no for "is there a lead-in at all." For a designed length, I would also print silencedetect, and I would subtract the decoded-vs-nominal duration before calling a 19 ms tail a creative choice.
These files are synthetic tones, not a paid Hit the Road Dude render, and they are not a claim about how the studio's voice is padded. Watch the clip through before you post it. The original-audio guide is the place that says a mouth can miss the new voice, and that an odd mouth on a finished file is still a delivered clip. This check will not fix that. It will tell you, in seconds, whether the file itself starts or ends on silence.
來源:DEV Community · dev.to