You've already forked VptPassiveAdapter
fix(video): 修复视频剪辑时间戳处理问题
- 调整 -ss 参数位置以确保正确的剪辑起始时间 - 移除多余的 -reset_timestamps 参数避免时间戳重置问题 - 确保 -fflags +genpts 参数在正确的命令序列中设置 - 修复拼接操作中的时间偏移参数顺序 - 优化视频处理流程中的时间戳生成逻辑
This commit is contained in:
@@ -331,13 +331,12 @@ func QuickVideoCut(ctx context.Context, inputFile string, offset, length float64
|
|||||||
FfmpegExec,
|
FfmpegExec,
|
||||||
"-hide_banner",
|
"-hide_banner",
|
||||||
"-y",
|
"-y",
|
||||||
|
"-ss", strconv.FormatFloat(offset, 'f', 2, 64),
|
||||||
"-i", inputFile,
|
"-i", inputFile,
|
||||||
"-f", "lavfi", "-i", "anullsrc=channel_layout=mono:sample_rate=44100",
|
"-f", "lavfi", "-i", "anullsrc=channel_layout=mono:sample_rate=44100",
|
||||||
"-c:v", "copy",
|
"-c:v", "copy",
|
||||||
"-c:a", "aac",
|
"-c:a", "aac",
|
||||||
"-shortest",
|
"-shortest",
|
||||||
"-reset_timestamps", "1",
|
|
||||||
"-ss", strconv.FormatFloat(offset, 'f', 2, 64),
|
|
||||||
"-t", strconv.FormatFloat(length, 'f', 2, 64),
|
"-t", strconv.FormatFloat(length, 'f', 2, 64),
|
||||||
"-fflags", "+genpts",
|
"-fflags", "+genpts",
|
||||||
"-f", "mp4",
|
"-f", "mp4",
|
||||||
@@ -376,13 +375,14 @@ func QuickConcatVideoCut(ctx context.Context, inputFiles []dto.File, offset, len
|
|||||||
"-y",
|
"-y",
|
||||||
"-f", "concat",
|
"-f", "concat",
|
||||||
"-safe", "0",
|
"-safe", "0",
|
||||||
|
"-ss", strconv.FormatFloat(offset, 'f', 2, 64),
|
||||||
"-i", tmpFile,
|
"-i", tmpFile,
|
||||||
"-f", "lavfi", "-i", "anullsrc=channel_layout=mono:sample_rate=44100",
|
"-f", "lavfi", "-i", "anullsrc=channel_layout=mono:sample_rate=44100",
|
||||||
"-c:v", "copy",
|
"-c:v", "copy",
|
||||||
"-c:a", "aac",
|
"-c:a", "aac",
|
||||||
"-shortest",
|
"-shortest",
|
||||||
"-ss", strconv.FormatFloat(offset, 'f', 2, 64),
|
|
||||||
"-t", strconv.FormatFloat(length, 'f', 2, 64),
|
"-t", strconv.FormatFloat(length, 'f', 2, 64),
|
||||||
|
"-fflags", "+genpts",
|
||||||
"-f", "mp4",
|
"-f", "mp4",
|
||||||
outputFile,
|
outputFile,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user