diff --git a/internal/worker/command_ffmpeg.go b/internal/worker/command_ffmpeg.go index 196df5a1..e62249eb 100644 --- a/internal/worker/command_ffmpeg.go +++ b/internal/worker/command_ffmpeg.go @@ -13,6 +13,7 @@ import ( "os/exec" "path/filepath" "runtime" + "strconv" "strings" "github.com/google/shlex" @@ -185,6 +186,8 @@ func cmdFramesToVideoParams(logger zerolog.Logger, cmd api.Command) (CreateVideo parameters.exe = exeArgs[0] parameters.argsBefore = allArgsBefore } + parameters.args = append(parameters.args, + "-r", strconv.FormatFloat(parameters.fps, 'f', -1, 64)) return parameters, nil } diff --git a/internal/worker/command_ffmpeg_test.go b/internal/worker/command_ffmpeg_test.go index a73ce6fc..1805df95 100644 --- a/internal/worker/command_ffmpeg_test.go +++ b/internal/worker/command_ffmpeg_test.go @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-3.0-or-later package worker import ( @@ -12,8 +13,6 @@ import ( "git.blender.org/flamenco/pkg/api" ) -// SPDX-License-Identifier: GPL-3.0-or-later - func TestCmdFramesToVideoSimplePosix(t *testing.T) { // Windows and non-Windows platforms differ in how they communicate globs to FFmpeg. if runtime.GOOS == "windows" { @@ -31,6 +30,7 @@ func TestCmdFramesToVideoSimplePosix(t *testing.T) { "exe": "/path/to/ffmpeg -v quiet", "argsBefore": []string{"-report"}, "inputGlob": "path/to/renders/*.png", + "fps": 10.0, "args": []string{ "-c:v", "hevc", "-crf", "31", @@ -45,6 +45,7 @@ func TestCmdFramesToVideoSimplePosix(t *testing.T) { "-report", // argsBefore "-pattern_type", "glob", "-i", "path/to/renders/*.png", // inputGlob "-c:v", "hevc", "-crf", "31", "-vf", "pad=ceil(iw/2)*2:ceil(ih/2)*2", // args + "-r", "10", // fps "path/to/renders/preview.mkv", // outputFile } mocks.cli.EXPECT().CommandContext(gomock.Any(), "/path/to/ffmpeg", cliArgs).Return(nil) @@ -70,6 +71,7 @@ func TestCmdFramesToVideoSimpleWindows(t *testing.T) { "exe": "/path/to/ffmpeg -v quiet", "argsBefore": []string{"-report"}, "inputGlob": "path/to/renders/*.png", + "fps": 10.0, "args": []string{ "-c:v", "hevc", "-crf", "31", @@ -84,6 +86,7 @@ func TestCmdFramesToVideoSimpleWindows(t *testing.T) { "-report", // argsBefore "-f", "concat", "-i", "this-is-random.txt", // input glob "-c:v", "hevc", "-crf", "31", "-vf", "pad=ceil(iw/2)*2:ceil(ih/2)*2", // args + "-r", "10", // fps "path/to/renders/preview.mkv", // outputFile } mocks.cli.EXPECT().