Update ffmpeg pkg for reading files and parsing ffmpeg version

This commit is contained in:
Alex X
2024-05-24 11:06:51 +03:00
parent ff39e2e496
commit bf3f81ccac
5 changed files with 78 additions and 47 deletions

View File

@@ -3,6 +3,7 @@ package ffmpeg
import (
"testing"
"github.com/AlexxIT/go2rtc/pkg/ffmpeg"
"github.com/stretchr/testify/require"
)
@@ -292,3 +293,23 @@ func TestDrawText(t *testing.T) {
})
}
}
func TestVersion(t *testing.T) {
verAV = ffmpeg.Version61
tests := []struct {
name string
source string
expect string
}{
{
source: "/media/bbb.mp4",
expect: `ffmpeg -hide_banner -readrate_initial_burst 0.001 -re -i /media/bbb.mp4 -c copy -user_agent ffmpeg/go2rtc -rtsp_transport tcp -f rtsp {output}`,
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
args := parseArgs(test.source)
require.Equal(t, test.expect, args.String())
})
}
}