Worker: include -r {fps}
in FFmpeg command
This should force the output created by FFmpeg to match the desired FPS.
This commit is contained in:
parent
cb494a4c03
commit
c79983bafb
@ -13,6 +13,7 @@ import (
|
|||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/google/shlex"
|
"github.com/google/shlex"
|
||||||
@ -185,6 +186,8 @@ func cmdFramesToVideoParams(logger zerolog.Logger, cmd api.Command) (CreateVideo
|
|||||||
parameters.exe = exeArgs[0]
|
parameters.exe = exeArgs[0]
|
||||||
parameters.argsBefore = allArgsBefore
|
parameters.argsBefore = allArgsBefore
|
||||||
}
|
}
|
||||||
|
parameters.args = append(parameters.args,
|
||||||
|
"-r", strconv.FormatFloat(parameters.fps, 'f', -1, 64))
|
||||||
|
|
||||||
return parameters, nil
|
return parameters, nil
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
package worker
|
package worker
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@ -12,8 +13,6 @@ import (
|
|||||||
"git.blender.org/flamenco/pkg/api"
|
"git.blender.org/flamenco/pkg/api"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
|
|
||||||
func TestCmdFramesToVideoSimplePosix(t *testing.T) {
|
func TestCmdFramesToVideoSimplePosix(t *testing.T) {
|
||||||
// Windows and non-Windows platforms differ in how they communicate globs to FFmpeg.
|
// Windows and non-Windows platforms differ in how they communicate globs to FFmpeg.
|
||||||
if runtime.GOOS == "windows" {
|
if runtime.GOOS == "windows" {
|
||||||
@ -31,6 +30,7 @@ func TestCmdFramesToVideoSimplePosix(t *testing.T) {
|
|||||||
"exe": "/path/to/ffmpeg -v quiet",
|
"exe": "/path/to/ffmpeg -v quiet",
|
||||||
"argsBefore": []string{"-report"},
|
"argsBefore": []string{"-report"},
|
||||||
"inputGlob": "path/to/renders/*.png",
|
"inputGlob": "path/to/renders/*.png",
|
||||||
|
"fps": 10.0,
|
||||||
"args": []string{
|
"args": []string{
|
||||||
"-c:v", "hevc",
|
"-c:v", "hevc",
|
||||||
"-crf", "31",
|
"-crf", "31",
|
||||||
@ -45,6 +45,7 @@ func TestCmdFramesToVideoSimplePosix(t *testing.T) {
|
|||||||
"-report", // argsBefore
|
"-report", // argsBefore
|
||||||
"-pattern_type", "glob", "-i", "path/to/renders/*.png", // inputGlob
|
"-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
|
"-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
|
"path/to/renders/preview.mkv", // outputFile
|
||||||
}
|
}
|
||||||
mocks.cli.EXPECT().CommandContext(gomock.Any(), "/path/to/ffmpeg", cliArgs).Return(nil)
|
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",
|
"exe": "/path/to/ffmpeg -v quiet",
|
||||||
"argsBefore": []string{"-report"},
|
"argsBefore": []string{"-report"},
|
||||||
"inputGlob": "path/to/renders/*.png",
|
"inputGlob": "path/to/renders/*.png",
|
||||||
|
"fps": 10.0,
|
||||||
"args": []string{
|
"args": []string{
|
||||||
"-c:v", "hevc",
|
"-c:v", "hevc",
|
||||||
"-crf", "31",
|
"-crf", "31",
|
||||||
@ -84,6 +86,7 @@ func TestCmdFramesToVideoSimpleWindows(t *testing.T) {
|
|||||||
"-report", // argsBefore
|
"-report", // argsBefore
|
||||||
"-f", "concat", "-i", "this-is-random.txt", // input glob
|
"-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
|
"-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
|
"path/to/renders/preview.mkv", // outputFile
|
||||||
}
|
}
|
||||||
mocks.cli.EXPECT().
|
mocks.cli.EXPECT().
|
||||||
|
Loading…
x
Reference in New Issue
Block a user