This commit is contained in:
2026-03-12 15:56:06 +08:00
parent f8f0e92723
commit 030d8e9e6d
4 changed files with 174 additions and 0 deletions

View File

@@ -470,6 +470,26 @@ func handleFfmpegProcess(ctx context.Context, ffmpegCmd []string) (bool, error)
return true, nil
}
func CompressTo720p(ctx context.Context, inputFile, outputFile string) (bool, error) {
subCtx, span := tracer.Start(ctx, "CompressTo720p")
defer span.End()
ffmpegCmd := []string{
FfmpegExec,
"-hide_banner",
"-y",
"-i", inputFile,
"-vf", "scale=-2:720",
"-c:v", "libx264",
"-preset", "fast",
"-crf", "28",
"-c:a", "aac",
"-b:a", "128k",
"-f", "mp4",
outputFile,
}
return handleFfmpegProcess(subCtx, ffmpegCmd)
}
func GetVideoCodec(ctx context.Context, filePath string) (string, error) {
_, span := tracer.Start(ctx, "GetVideoCodec")
defer span.End()