Back to GitHub Projects
    Open Source · Python

    AWS Media Transcriber

    A serverless video transcription app built with AWS SAM: uploads go straight to S3, Step Functions drives Amazon Transcribe, and a Next.js front end shows the text.

    AWSServerlessStep Functions
    View on GitHub
    AWS Media Transcriber Architecture

    About

    AWS Media Transcriber turns an uploaded video or audio file into plain text. A Next.js front end asks API Gateway for a pre-signed S3 POST and uploads the file straight to S3, so it never passes through Lambda. It then asks the API to start processing. That starts a Step Functions workflow that runs an Amazon Transcribe job, polls it until it finishes, and saves a plain-text transcript next to the raw JSON. The backend is one AWS SAM template: an S3 bucket, a REST API, four Python 3.11 Lambda functions sharing one layer, an IAM role for Transcribe and the state machine.

    How it works

    The front end calls POST /upload-url with a file name and content type. The API handler returns a pre-signed POST for a key under uploads/, valid for an hour, and the browser posts the file to S3 directly. It then calls POST /process-video with that key, and the handler starts a Step Functions execution.

    The state machine runs three Lambda tasks. The first starts a Transcribe job with speaker labels, writing JSON to transcriptions/. The workflow waits 15 seconds, then the second task checks the job. A Choice state loops back to the wait until the job reports COMPLETED or FAILED. On success the third task pulls the transcript text out of the JSON and saves it as a .txt file, which GET /get-transcription returns.

    Limits worth knowing

    This is a demo, not a product. The login screen accepts any username and password, CORS allows every origin, and the role Transcribe assumes carries the managed AmazonS3FullAccess policy instead of access to one bucket. All three need tightening before real use. Put an identity provider such as Cognito in front of the API, allow only known origins, and scope the role to the uploads/ and transcriptions/ prefixes.

    The 1 GB limit is checked in the browser only. The pre-signed POST carries no content-length condition, so S3 does not enforce it. The optional transcription instructions field reaches the workflow, but no step reads it. Language is fixed to en-US, and two speakers is the ceiling for speaker labels.

    Key Features

    Three API routes: POST /upload-url, POST /process-video and GET /get-transcription
    Browser uploads go straight to S3 with a pre-signed POST that expires after an hour
    Step Functions loop: start the job, wait 15 seconds, check the status, repeat until done
    Every task retries 3 times with exponential backoff, then falls through to a failure state
    English (en-US) transcription with speaker labels for up to two speakers
    Raw Transcribe JSON plus a plain-text .txt transcript under transcriptions/
    Versioned bucket with SSE-S3 encryption and all public access blocked
    X-Ray tracing on the API stage
    Next.js front end with dark and light themes, an upload history and a 1-hour inactivity timeout

    Engineering Challenges

    Accepting files up to 1 GB without pushing them through API Gateway or Lambda, which both cap request size far below that.
    Waiting minutes for a transcription job without a Lambda function sitting idle. The state machine's Wait state costs nothing while it waits.
    Mapping file extensions to the media formats Transcribe accepts. MOV, AVI and M4A are sent as mp4, and an unknown extension falls back to mp4.
    Giving Transcribe its own data-access role so it can read the upload and write its output into the same bucket.

    Results & Impact

    One sam deploy creates the bucket, the API, the functions and the workflow.
    Large uploads never touch the API, so its request size limit does not apply.
    A failed job ends in an explicit failure state instead of a function timeout.
    Readers get a plain-text transcript, not only Transcribe's JSON.