feat: add compress video logics

This commit is contained in:
yanghao05
2025-03-29 16:02:05 +08:00
parent c7dbeae122
commit 754f938e76
17 changed files with 1952 additions and 199 deletions

View File

@@ -0,0 +1,35 @@
package queue
import (
"os"
"path/filepath"
"testing"
"github.com/rogeecn/fabfile"
. "github.com/smartystreets/goconvey/convey"
)
func Test_getVideoSize(t *testing.T) {
Convey("getVideoSize", t, func() {
Convey("test getVideoSize", func() {
file := fabfile.MustFind("fixtures/camera.mp4")
width, height, err := getVideoSize(file)
So(err, ShouldBeNil)
So(width, ShouldEqual, 1924)
So(height, ShouldEqual, 1080)
})
})
}
func Test_compressVideo(t *testing.T) {
Convey("compressVideo", t, func() {
Convey("test compressVideo", func() {
srcFile := fabfile.MustFind("fixtures/camera.mp4")
dstFile := filepath.Join(os.TempDir(), "camera.mp4")
t.Log("dstFile", dstFile)
err := compressVideo(srcFile, dstFile)
So(err, ShouldBeNil)
})
})
}