When using the Concat() function for more than 10 inputs, the original ordering of those input files are not correctly preserved.
In the following small case below, 16 input streams are created (0, 1, 2, 3, ..., 14, 15), but the final output command has the order (0, 1, 10, 11, 12, 13, 14, 15, 2, 3, 4, ... 8, 9) as if the indices were sorted lexicographically.
Minimal reproducible case
Source code:
package main
import (
"fmt"
ffmpeg "github.com/u2takey/ffmpeg-go"
)
func main() {
filelist := []string{}
for i := 0; i < 16; i++ {
filelist = append(filelist, fmt.Sprintf("test%d.mp4", i))
}
inputs := make([]*ffmpeg.Stream, 0, len(filelist))
for _, v := range filelist {
inputs = append(inputs, ffmpeg.Input(v))
}
ff_task := ffmpeg.Concat(inputs).Output("output.mp4").OverWriteOutput()
println(ff_task.Compile())
mermaid_view, _ := ff_task.View(ffmpeg.ViewTypeFlowChart)
println(mermaid_view)
}
Overview
When using the
Concat()
function for more than 10 inputs, the original ordering of those input files are not correctly preserved.In the following small case below, 16 input streams are created (0, 1, 2, 3, ..., 14, 15), but the final output command has the order (0, 1, 10, 11, 12, 13, 14, 15, 2, 3, 4, ... 8, 9) as if the indices were sorted lexicographically.
Minimal reproducible case
Source code:
Compiled command:
Mermaid dependency graph: