1
Fork 0

Add video_codec.

This commit is contained in:
Googol Lee 2024-09-17 15:59:27 +02:00
parent 37c4b45f2f
commit 466ce59e31
2 changed files with 12 additions and 4 deletions

View File

@ -11,7 +11,8 @@ import (
)
type FfmpegCli struct {
path string
path string
videoCodec string
}
func newFfmpegCli() *FfmpegCli {
@ -43,10 +44,16 @@ func newFfmpegCli() *FfmpegCli {
return nil
}
log.Printf("Found executable worker: ffmpeg (%s)\n", strings.Split(string(version), "\n")[0])
codec := utils.EnvVideoCodec.GetValue()
if codec == "" {
codec = "h264"
}
log.Printf("Found executable worker: ffmpeg (%s) with codec %q\n", strings.Split(string(version), "\n")[0], codec)
return &FfmpegCli{
path: path,
path: path,
videoCodec: codec,
}
}
@ -58,7 +65,7 @@ func (worker *FfmpegCli) EncodeMp4(inputPath string, outputPath string) error {
args := []string{
"-i",
inputPath,
"-vcodec", "h264",
"-vcodec", worker.videoCodec,
"-acodec", "aac",
"-vf", "scale='min(1080,iw)':'min(1080,ih)':force_original_aspect_ratio=decrease:force_divisible_by=2",
"-movflags", "+faststart+use_metadata_tags",

View File

@ -38,6 +38,7 @@ const (
EnvDisableFaceRecognition EnvironmentVariable = "PHOTOVIEW_DISABLE_FACE_RECOGNITION"
EnvDisableVideoEncoding EnvironmentVariable = "PHOTOVIEW_DISABLE_VIDEO_ENCODING"
EnvDisableRawProcessing EnvironmentVariable = "PHOTOVIEW_DISABLE_RAW_PROCESSING"
EnvVideoCodec EnvironmentVariable = "PHOTOVIEW_VIDEO_CODEC"
)
// GetName returns the name of the environment variable itself