挑战
固定容量的编码基础设施要么过度配置(成本高昂),要么配置不足(速度缓慢):
- 编码工作负载变化多端且不可预测
- 在内容发布期间,高峰时段可能会达到正常流量的 100 倍
- 在闲置时段,24/7 运行专用编码服务器成本高昂
- 作业失败需要自动检测和重试,无需人工干预
我们的解决方案
我们实施了一个无服务器编码管道,使用 AWS Lambda 触发器和 AWS MediaConvert 进行弹性、按需付费的视频处理。
架构
- 触发器:监控 S3 上传事件的 AWS Lambda 函数
- 编码:使用合作伙伴专用作业模板的 AWS MediaConvert
- 消息传递:用于异步作业状态更新的 ActiveMQ/STOMP
- 监控:跟踪作业进度的 NestJS 编码器后端
- 存储:用于输入/输出资产的 AWS S3
管道流程
- S3 事件 - 视频上传触发 Lambda 函数
- 作业配置 - Lambda 读取合作伙伴配置文件并构建 MediaConvert 作业
- 提交 - MediaConvert 作业与适当的输出设置一起提交
- 进度跟踪 - STOMP 消息将状态中继到编码器后端
- 完成 - 输出资产存储在 S3 中,元数据在 MongoDB 中更新
- 错误处理 - 失败的作业排队等待指数退避重试
主要特点
- 零闲置成本 - Lambda 和 MediaConvert 仅根据实际使用量收费
- 弹性扩展 - 处理 1 到 1000 多个并发编码作业
- 合作伙伴模板 - 每个合作伙伴预配置的 MediaConvert 作业模板
- 事件驱动 - S3 事件自动触发编码工作流
- 全面监控 - 作业状态、持续时间和错误跟踪
成果
技术栈
caseStudyDetail.more 案例研究
探索更多我们的技术实施案例
SCTE-35 广告标记信令与媒体预告片插入管道
一家流媒体公司需要一个强大、自动化的管道,用于将 SCTE-35 广告标记注入直播和 VOD 流中,并能将宣传预告片(前贴片、中贴片和后贴片)精确地插入指定位置——从而实现跨 FAST 频道、直播活动和点播内容库的变现。
利用 AWS 媒体服务通过 SRT 传输 FAST 频道流媒体
一家媒体公司需要使用 Secure Reliable Transport (SRT) 协议,为其 FAST 频道建立可靠、低延迟的贡献源,从而能够通过不稳定的互联网连接,从远程工作室、云播放系统和联合发行合作伙伴摄取高质量内容。
常见问题
MicrocosmWorks designed a segmented processing architecture where Step Functions orchestrate the pipeline: Lambda functions split source videos into segments, AWS MediaConvert handles the actual transcoding without Lambda timeout constraints, and a final Lambda stitches the output. This hybrid approach keeps the serverless cost model while supporting videos of any duration.
MicrocosmWorks measured a 70-85% cost reduction for bursty video processing workloads compared to running dedicated EC2 encoding instances. The serverless pipeline incurs zero cost when idle and scales to hundreds of concurrent jobs during peak periods, with AWS MediaConvert's per-minute pricing eliminating the need to provision for peak capacity.
MicrocosmWorks configured AWS Step Functions with per-step retry policies and exponential backoff, ensuring that a failed transcode step retries automatically without restarting the entire pipeline. Each stage writes intermediate outputs to S3, so recovery resumes from the last successful checkpoint rather than reprocessing from the source file.
MicrocosmWorks optimized the pipeline for near-real-time use cases with cold start mitigation using provisioned concurrency on critical Lambda functions and MediaConvert reserved transcoding slots. For live workflows, the pipeline achieves 2-5 minute end-to-end latency from upload to delivery, which is suitable for clip extraction and highlights distribution.
MicrocosmWorks builds serverless video infrastructure at rates of $25-$45/hr, with a complete MediaConvert-based pipeline including Step Functions orchestration, S3 lifecycle management, and monitoring typically requiring 250-400 development hours. The architecture's pay-per-use model means clients only pay AWS costs proportional to their actual processing volume.
