From 37632f985b7f2810fc4d1553c4b126e2ee5edfea Mon Sep 17 00:00:00 2001 From: WithoutPants <53250216+WithoutPants@users.noreply.github.com> Date: Fri, 25 Mar 2022 13:50:02 +1100 Subject: [PATCH] Fix windows ffmpeg concat path (#2425) --- pkg/ffmpeg/encoder_scene_preview_chunk.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pkg/ffmpeg/encoder_scene_preview_chunk.go b/pkg/ffmpeg/encoder_scene_preview_chunk.go index 6adaddfdf..1e631859e 100644 --- a/pkg/ffmpeg/encoder_scene_preview_chunk.go +++ b/pkg/ffmpeg/encoder_scene_preview_chunk.go @@ -2,7 +2,9 @@ package ffmpeg import ( "fmt" + "runtime" "strconv" + "strings" ) type ScenePreviewChunkOptions struct { @@ -91,11 +93,19 @@ func (e *Encoder) ScenePreviewVideoChunk(probeResult VideoFile, options ScenePre return err } +// fixWindowsPath replaces \ with / in the given path because the \ isn't recognized as valid on windows ffmpeg +func fixWindowsPath(str string) string { + if runtime.GOOS == "windows" { + return strings.ReplaceAll(str, `\`, "/") + } + return str +} + func (e *Encoder) ScenePreviewVideoChunkCombine(probeResult VideoFile, concatFilePath string, outputPath string) error { args := []string{ "-v", "error", "-f", "concat", - "-i", concatFilePath, + "-i", fixWindowsPath(concatFilePath), "-y", "-c", "copy", outputPath,