{"id":15490445,"url":"https://github.com/sammarks/cloudformation-webm-mp3","last_synced_at":"2026-01-07T22:04:56.386Z","repository":{"id":43982688,"uuid":"244931425","full_name":"sammarks/cloudformation-webm-mp3","owner":"sammarks","description":"CloudFormation template to convert WEBM audio files to MP3 files.","archived":false,"fork":false,"pushed_at":"2023-01-05T09:03:15.000Z","size":1364,"stargazers_count":0,"open_issues_count":14,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-19T09:18:03.708Z","etag":null,"topics":["audio","aws","aws-lambda","cloudformation","cloudformation-template","conversion","sam","serverless","serverless-application-model"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sammarks.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-04T15:10:25.000Z","updated_at":"2020-04-08T16:00:00.000Z","dependencies_parsed_at":"2023-02-03T22:02:29.448Z","dependency_job_id":null,"html_url":"https://github.com/sammarks/cloudformation-webm-mp3","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sammarks%2Fcloudformation-webm-mp3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sammarks%2Fcloudformation-webm-mp3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sammarks%2Fcloudformation-webm-mp3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sammarks%2Fcloudformation-webm-mp3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sammarks","download_url":"https://codeload.github.com/sammarks/cloudformation-webm-mp3/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246061797,"owners_count":20717505,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["audio","aws","aws-lambda","cloudformation","cloudformation-template","conversion","sam","serverless","serverless-application-model"],"created_at":"2024-10-02T07:21:22.150Z","updated_at":"2026-01-07T22:04:56.355Z","avatar_url":"https://github.com/sammarks.png","language":"JavaScript","readme":"![][header-image]\n\n[![CircleCI](https://img.shields.io/circleci/build/github/sammarks/cloudformation-webm-mp3/master)](https://circleci.com/gh/sammarks/cloudformation-webm-mp3)\n[![Coveralls](https://img.shields.io/coveralls/sammarks/cloudformation-webm-mp3.svg)](https://coveralls.io/github/sammarks/cloudformation-webm-mp3)\n[![Dev Dependencies](https://david-dm.org/sammarks/cloudformation-webm-mp3/dev-status.svg)](https://david-dm.org/sammarks/cloudformation-webm-mp3?type=dev)\n[![Donate](https://img.shields.io/badge/donate-paypal-blue.svg)](https://paypal.me/sammarks15)\n\n`cloudformation-webm-mp3` is an AWS SAM + CloudFormation template designed to ingest WEBM audio\nfiles and convert them to MP3 files. It sends a notification through SNS to keep track of\nprogress, generate information about the audio file (like duration) and completion.\n\n## Get Started\n\nIt's simple! Click this fancy button:\n\n[![Launch Stack](https://s3.amazonaws.com/cloudformation-examples/cloudformation-launch-stack.png)](https://console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/new?stackName=webm-mp3\u0026templateURL=https://sammarks-cf-templates.s3.amazonaws.com/webm-mp3/template.yaml)\n\nThen give the stack a name, and configure it:\n\n### Parameters\n\n| Parameter | Required | Default Value | Description |\n| --- | --- | --- | --- |\n| InputBucketName | **Yes** | | The name of the bucket to use for audio inputs. **This bucket MUST NOT already exist.** |\n| OutputBucketName | **Yes** | | The name of the bucket to use for output audio files. **This bucket MUST already exist.** |\n| SubnetNames | **Yes** | | A comma-separated list of VPC subnets to launch the Fargate container in. |\n| SecurityGroupNames | **Yes** | | A comma-separated list of VPC security groups (that have access to the internet) to launch the Fargate container in. |\n| ContainerName | No | `webm-convert-audio` | The name of the Fargate container. |\n\n### Outputs\n\n| Output | Description |\n| --- | --- |\n| InputBucket | The name of the bucket where audio files should be uploaded. |\n| InputBucketArn | The ARN for the bucket where audio files should be uploaded. |\n| Topic | The ARN for the SNS Topic to subscribe to for pipeline notifications. |\n| S3Topic | The ARN for the SNS Topic to subscribe to for object creation notifications from the input bucket. |\n\n### Usage in Another Stack or Serverless\n\nAdd something like this underneath resources:\n\n```yaml\nvideoThumbnailStack:\n  Type: AWS::CloudFormation::Stack\n  Properties:\n    TemplateURL: https://sammarks-cf-templates.s3.amazonaws.com/webm-mp3/VERSION/template.yaml\n    Parameters:\n      InputBucketName: test-input-bucket\n      OutputBucketName: test-output-bucket\n      SubnetNames: subnet-aaaaa,subnet-bbbbb\n      SecurityGroupNames: sg-aaaaa,sg-bbbbb\n      ContainerName: webm-convert-audio\n```\n\n**Note:** This stack will require the `CAPABILITY_AUTO_EXPAND` capability when deploying\nthe parent stack with CloudFormation. If you are using the Serverless framework, you can\n\"trick\" it into adding the required capabilities by adding this to your `serverless.yaml`:\n\n```yaml\nresources:\n  Transform: 'AWS::Serverless-2016-10-31' # Trigger Serverless to add CAPABILITY_AUTO_EXPAND\n  Resources:\n    otherResource: # ... all of your original resources\n```\n\n### Regions\n\n**A quick note on regions:** If you are deploying this stack in a region other than `us-east-1`,\nyou need to reference the proper region S3 bucket as we're deploying Lambda functions. Just\nadd the region suffix to the template URL, so this:\n\n```\nhttps://sammarks-cf-templates.s3.amazonaws.com/webm-mp3/VERSION/template.yaml\n```\n\nbecomes this:\n\n```\nhttps://sammarks-cf-templates-us-east-2.s3.amazonaws.com/webm-mp3/VERSION/template.yaml\n```\n\n### Subscribing to object creation events\n\nS3 does not allow two separate Lambda functions to be subscribed to the same\nevent types on a single bucket. Because of this, the template creates an SNS\ntopic to serve as the messenger for the S3 notifications, and the internal\nLambda function subscribes to that SNS topic.\n\nBecause of this, if you want to subscribe to the object creation events in your\nown Lambda functions, simply create a Lambda function that references the\n`S3Topic` output of this stack.\n\n### What's deployed?\n\n- One S3 bucket, for audio input.\n- A SNS topic for notifications.\n- A SNS topic for object created notifications for the input bucket.\n- An ECS cluster and task definition to contain the configuration for the\n  conversion Docker container.\n- A Lambda function to launch a new instance of the task definition inside\n  Fargate when an audio file needs to be converted.\n\n### How does it work?\n\nWhenever an audio file is uploaded to the input bucket, it goes through the following\nprocess:\n\n- The Lambda is triggered and verifies the file ends in `.webm` - it will throw\n  an error if it does not.\n- Lambda creates a new instance of the task definition and launches it inside\n  Fargate with your provided VPC configuration.\n- The Docker container downloads the file to temporary storage, runs it through\n  `ffmpeg` to convert the container from WEBM to MP3, and then uploads the result\n  to the destination bucket inside S3.\n  - It gathers information about the audio file (like duration) and records it\n    as well.\n- Send a notification to SNS when the process is complete or errors.\n\n#### Why Fargate / Docker containers?\n\nSee [cloudformation-webm-mp4](https://github.com/sammarks/cloudformation-webm-mp4#why-fargate--docker-containers) for more information.\n\n### Accessing Previous Versions \u0026 Upgrading\n\nEach time a release is made in this repository, the corresponding template is available at:\n\n```\nhttps://sammarks-cf-templates.s3.amazonaws.com/webm-mp3/VERSION/template.yaml\n```\n\n**On upgrading:** I actually _recommend_ you lock the template you use to a specific version. Then, if you want to update to a new version, all you have to change in your CloudFormation template is the version and AWS will automatically delete the old stack and re-create the new one for you.\n\n## Features\n\n- Automatically convert `webm` audio files to `mp3` files.\n- Send notifications about updates and error messages to a SNS topic.\n- Uses AWS Lambda + AWS Fargate so you only pay for the hours you are actively converting something.\n- Deploy with other CloudFormation-compatible frameworks (like the Serverless framework).\n- All functionality is self-contained within one CloudFormation template. Delete the template, and all of our created resources are removed.\n\n## Why use this?\n\nThe inspiration for this template was to easily convert audio files\ngenerated using the [MediaRecorder](https://developer.mozilla.org/en-US/docs/Web/API/MediaRecorder) APIs to MP3 files for broader consumption on mobile devices.\n\nRunning a Docker container with `ffmpeg` installed inside AWS Fargate to achieve this becomes\nimmensely cheaper than using something like AWS' ElementalMedia services because converting\naudio files is quick and easy with the smaller file sizes, so\nwe don't need the massive amount of CPU power something like AWS' ElementalMedia provides.\n\n[header-image]: https://raw.githubusercontent.com/sammarks/art/master/cloudformation-webm-mp3/header.jpg\n","funding_links":["https://paypal.me/sammarks15"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsammarks%2Fcloudformation-webm-mp3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsammarks%2Fcloudformation-webm-mp3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsammarks%2Fcloudformation-webm-mp3/lists"}