

For this demo, we are only considering mp4 files as sources. “” is a presigned URL to the Amazon S3 object.Overview of the codeįirst is the FFmpeg command we run in the Lambda function, where the output is not copied to a local file but instead sent to the standard output (stdout). The FFmpeg command used to convert audio VFR to CFR is similar to the following: ffmpeg -i -f mpegts -c:v copy -af aresample=async=1:first_pts=0 - Parameters explanation: We use FFmpeg to process the audio stream, but the same concept may work with other media processing tools as well.Ī foundational knowledge of Lambda, Amazon S3, AWS Identity and Access Management (IAM), FFmpeg, Boto3, and Python scripting language is recommended to build this workflow. The Lambda function we use can be used as a pre-processing stage for larger workloads. In this post, we build a demo that processes UGC and converts audio from VFR to CFR.

VFR audio may often lead to audio sync issues in media workloads. converting variable frame rate (VFR) audio to constant frame rate (CFR) audio, which is the use case we demonstrate in this postĭepending on the recording device, UGC is sometimes captured with VFR audio (with smartphones, for instance).converting audio-only files to audio/video (A/V) by inserting a video stream of a slate, black frames, or even a waveform.changing the media file format or container (re-packaging / re-wrapping).The workflow presented here can be used for a number of UGC processing use cases such as: For workloads dealing with larger media files beyond Lambda’s memory capacity, mounting an Amazon EFS file system should still be considered. UGC is any content created by individuals and is usually characterized by small or capped file sizes. Lambda functions can be configured with up to 10240 MB of memory, which makes the workflow well suited for processing user-generated content (UGC). Instead of copying media files locally for processing, we put together a workflow to use Lambda’s memory space. This approach, however, involves re-architecting the storage workflow (Amazon S3 and/or Amazon EFS), setting up and managing other services like Amazon Virtual Private Cloud (Amazon VPC), and may incur additional cost. At the same time, Lambda can be configured to mount an Amazon Elastic File System (Amazon EFS). Lambda is equipped with temporary storage space of 512 MB, which is often not sufficient for media processing. In this post, we introduce a workflow to process media files stored in Amazon Simple Storage Service (Amazon S3) using AWS Lambda that doesn’t require copying files to Lambda’s local storage.
