Skip to content

obrr-hhx/excamera_step_function

Repository files navigation

excamera_step_function

This is a very simple example for excamera built by aws step function.

Set the environment variable

AWS_ROLE => the role that can execute lambda fucntion and access s3.

Work Flow

The excamera work flow is referenced from the Makefile which is generated by gen_makefile.py.

To know more about the gen_makefile.py, click here.

This example uses four y4m files to execute the state machine, you can also get the y4m file from the link mentioned above.

what should be input to the state machine when executing is the input.json file. It just contains the s3 bucket name and your y4m file name.

Lambda function

There are four bianry executable files actully which is vpxenc, xc-terminate-chunk, xc-dump and xc-enc, although I deploy seven lambda function to compelete the work flow to process the video.

From the Makefile, you can find there are three stages to execute:

stage 1: vpxenc

using the vpxenc, xc-terminate-chunk and xc-dump to generate the .ivf file and .state file.

I use the map state in aws step function to do this stage tasks.

Which are used in this stage:

  • vpxenc
  • xc-terminate-chunk
  • xc-dump

stage 2: reencode-first-frame

As the title says, this stage's task is to re-encode the first frame. And I use the parallel state to accomplish.

Which are used in this stage:

  • xc-enc
  • xc-enc-reencode

stage 3: rebase

The lambda functions of xc-rebase are serial executed to rebase the frame.

Which are used in this stage:

  • xc-enc-rebase
    • xc-enc-rebase-02
    • xc-enc-rebase-03

you can deploy these function just using the follow command

git clone https://github.com/obrr-hhx/excamera_step_function.git
export AWS_ROLE='your aws role'
cd ./excamera_step_funcion
./deployAll.sh

Log

The Log.py generates a unique name for the log file when correlative lambda function is executing and records the time of downloading the y4m file, executing and uploading. It also writes down the name and size of each download and upload file.

At the last of the log file, the command executed in the lambda function will be put.

The log file will be stored in your s3 bucket which path's prefix is log/.

About

A simple sample of excamera using aws step function

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published