feat: add compress video logics
This commit is contained in:
35
backend/app/service/commands/compress_test.go
Normal file
35
backend/app/service/commands/compress_test.go
Normal 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)
|
||||
})
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user