add s3 stream support

This commit is contained in:
wanglei.w
2021-04-15 17:47:07 +08:00
parent bb39562fae
commit 180149a7c9
8 changed files with 120 additions and 8 deletions

View File

@@ -3,9 +3,17 @@ package examples
import (
"testing"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/disintegration/imaging"
"github.com/stretchr/testify/assert"
ffmpeg "github.com/u2takey/ffmpeg-go"
)
//
// More simple examples please refer to ffmpeg_test.go
//
func TestExampleStream(t *testing.T) {
ExampleStream("./sample_data/in1.mp4", "./sample_data/out1.mp4", false)
}
@@ -26,7 +34,18 @@ func TestExampleShowProgress(t *testing.T) {
ExampleShowProgress("./sample_data/in1.mp4", "./sample_data/out2.mp4")
}
func TestExampleOpenCvFaceDetect(t *testing.T) {
ExampleFaceDetection("./sample_data/head-pose-face-detection-male-short.mp4",
"./sample_data/haarcascade_frontalface_default.xml")
func TestSimpleS3StreamExample(t *testing.T) {
err := ffmpeg.Input("./sample_data/in1.mp4", nil).
Output("s3://data-1251825869/test_out.ts", ffmpeg.KwArgs{
"aws_config": &aws.Config{
Credentials: credentials.NewStaticCredentials("xx", "yyy", ""),
//Endpoint: aws.String("xx"),
Region: aws.String("yyy"),
},
// outputS3 use stream output, so you can only use supported format
// if you want mp4 format for example, you can output it to a file, and then call s3 sdk to do upload
"format": "mpegts",
}).
Run()
assert.Nil(t, err)
}