fix(video): 修复视频剪辑时间戳处理问题

- 调整 -ss 参数位置以确保正确的剪辑起始时间
- 移除多余的 -reset_timestamps 参数避免时间戳重置问题
- 确保 -fflags +genpts 参数在正确的命令序列中设置
- 修复拼接操作中的时间偏移参数顺序
- 优化视频处理流程中的时间戳生成逻辑
This commit is contained in:
2026-03-06 17:31:12 +08:00
parent a951517cfd
commit 181a6b5368

View File

@@ -331,13 +331,12 @@ func QuickVideoCut(ctx context.Context, inputFile string, offset, length float64
FfmpegExec,
"-hide_banner",
"-y",
"-ss", strconv.FormatFloat(offset, 'f', 2, 64),
"-i", inputFile,
"-f", "lavfi", "-i", "anullsrc=channel_layout=mono:sample_rate=44100",
"-c:v", "copy",
"-c:a", "aac",
"-shortest",
"-reset_timestamps", "1",
"-ss", strconv.FormatFloat(offset, 'f', 2, 64),
"-t", strconv.FormatFloat(length, 'f', 2, 64),
"-fflags", "+genpts",
"-f", "mp4",
@@ -376,13 +375,14 @@ func QuickConcatVideoCut(ctx context.Context, inputFiles []dto.File, offset, len
"-y",
"-f", "concat",
"-safe", "0",
"-ss", strconv.FormatFloat(offset, 'f', 2, 64),
"-i", tmpFile,
"-f", "lavfi", "-i", "anullsrc=channel_layout=mono:sample_rate=44100",
"-c:v", "copy",
"-c:a", "aac",
"-shortest",
"-ss", strconv.FormatFloat(offset, 'f', 2, 64),
"-t", strconv.FormatFloat(length, 'f', 2, 64),
"-fflags", "+genpts",
"-f", "mp4",
outputFile,
}