You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用AWS SDK for Java 2.x创建MediaLive归档输出组时S3目标报错求助

解决方案

报错的核心原因是误用了destinationRefId:这个字段是用来引用提前在Channel的destinations列表中定义好的目标ID,不能直接填写S3 URI。

方式一:直接配置S3目标(推荐,适合单OutputGroup场景)

修改archiveGroupSettings中的destination配置,直接指定S3存储桶和前缀:

return OutputGroup.builder()
    .name("archive-s3")
    .outputGroupSettings(outputGroupSettings -> outputGroupSettings
        .archiveGroupSettings(archiveGroupSettings -> archiveGroupSettings
            .rolloverInterval(300)
            .destination(destination -> destination
                .s3DestinationSettings(s3Dest -> s3Dest
                    .bucketName(s3Uri.bucket()) // 从S3Uri中提取桶名
                    .prefix(s3Uri.key())      // 从S3Uri中提取文件夹前缀
                    .build())
                .build())
            .build())
        .build())
    .outputs(archiveOutput)
    .build();

方式二:通过refId复用目标(适合多OutputGroup共用同一路径场景)

  1. 先在Channel的destinations中定义S3目标:
// 构建Channel时添加
Channel channel = Channel.builder()
    // 其他Channel基础配置
    .destinations(dest -> dest
        .id("s3-archive-dest")
        .s3DestinationSettings(s3Dest -> s3Dest
            .bucketName(s3Uri.bucket())
            .prefix(s3Uri.key())
            .build())
        .build())
    .build();
  1. 然后在ArchiveGroupSettings中引用该ID:
.archiveGroupSettings(archiveGroupSettings -> archiveGroupSettings
    .rolloverInterval(300)
    .destination(destination -> destination.destinationRefId("s3-archive-dest"))
    .build())

另外建议:代码中M2TS配置过于冗余,控制台默认设置无需手动全部指定,仅保留需要修改的参数(比如nameModifier)即可,降低维护成本和出错概率。

内容的提问来源于stack exchange,提问作者B Randall

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.25 15:03:19