Golang-从Amazon S3读取流式.mp4

My aim is to setup a streaming video from a mobile phone to my API and I need to send each frame of the stream to an other script which will analyze the frames. In the end I want the video to be stored on the server.

As I've got no knowledge about streaming protocols (especially between a mobile and a server) I've requested the help of freelancers who had set up a wowza instance.

Thus, through this wowza, when you start recording on your mobile I can see myStream.mp4 and myStream.mp4.tmp appearing on the S3 bucket.

So now, I've tried the s3.GetObject method with this flow:

svc := s3.New(session.New(), &aws.Config{Region: aws.String("region1"), Credentials: creds})

params := &s3.GetObjectInput{
    Bucket: aws.String("bucket-name"),
    Key:    aws.String("mypath/myStream.mp4"),
}

result, err := svc.GetObject(params)
if err != nil {
    fmt.Fprintln(os.Stderr, err)
    os.Exit(1)
}

_, err = io.Copy(os.Stdout, result.Body)
if err == io.EOF {
    fmt.Println("END OF FILE \\o/")
}
defer result.Body.Close()

But it get the object at an instant T.

So, I've 2 questions:

  • Do you know a way to "read" the file while it's streaming?
  • I've the feeling the return will be bytes when my script is waiting for pixels.. Which could be cool if I have .mp4 frames and I'm a bit clueless about what to look for.