mirror of
https://github.com/u2takey/ffmpeg-go.git
synced 2025-10-05 16:06:52 +08:00
add s3 stream support
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user