admin管理员组

文章数量:1122826

I was trying to create mediaLive channel. I have created a input as well as media package channel, but when I try to create mediaLive, It is giving following error:

Exception in thread "main" software.amazon.awssdk.services.medialive.model.UnprocessableEntityException: Object references undefined destination "media-package-channel" (Service: MediaLive, Status Code: 422, Request ID: ec05c59a-5f0d-4eed-bc6d-85fcd15400c5)

Below is code snippet:


    public static CreateChannelResponse createMediaLiveChannel5(
            MediaLiveClient mediaLiveClient, String channelName, String inputId, String mediaPackageChannel) {

        // Define Encoder Settings
        EncoderSettings encoderSettings = EncoderSettings.builder()
                .timecodeConfig(TimecodeConfig.builder()
                        .source(TimecodeConfigSource.EMBEDDED)
                        .build())
                .videoDescriptions(
                        VideoDescription.builder()
                                .name("video_q7t5tl")
                                .width(1280)
                                .height(720)
                                .sharpness(50)
                                .scalingBehavior("DEFAULT")
                                .respondToAfd("NONE")
                                .codecSettings(VideoCodecSettings.builder()
                                        .h264Settings(H264Settings.builder()
                                                .adaptiveQuantization(H264AdaptiveQuantization.AUTO)
                                                .afdSignaling(AfdSignaling.NONE)
                                                .colorMetadata(H264ColorMetadata.INSERT)
                                                .entropyEncoding(H264EntropyEncoding.CABAC)
                                                .flickerAq(H264FlickerAq.ENABLED)
                                                .forceFieldPictures(H264ForceFieldPictures.DISABLED)
                                                .framerateControl("SPECIFIED")
                                                .framerateNumerator(30000)
                                                .framerateDenominator(1001)
                                                .gopBReference(H264GopBReference.DISABLED)
                                                .gopClosedCadence(1)
                                                .gopSize(90.0)
                                                .gopSizeUnits(H264GopSizeUnits.FRAMES)
                                                .level(H264Level.H264_LEVEL_AUTO)
                                                .lookAheadRateControl(H264LookAheadRateControl.MEDIUM)
                                                .numRefFrames(1)
                                                .parControl(H264ParControl.SPECIFIED)
                                                .profile(H264Profile.MAIN)
                                                .rateControlMode(H264RateControlMode.CBR)
                                                .scanType(H264ScanType.PROGRESSIVE)
                                                .sceneChangeDetect(H264SceneChangeDetect.ENABLED)
                                                .spatialAq(H264SpatialAq.ENABLED)
                                                .subgopLength("FIXED")
                                                .syntax(H264Syntax.DEFAULT)
                                                .temporalAq(H264TemporalAq.ENABLED)
                                                .timecodeInsertion("DISABLED")
                                                .build())
                                        .build())
                                .build(),
                        VideoDescription.builder()
                                .name("video_d6yva3")
                                .width(1920)
                                .height(720)
                                .sharpness(50)
                                .scalingBehavior("DEFAULT")
                                .respondToAfd("NONE")
                                .codecSettings(VideoCodecSettings.builder()
                                        .h264Settings(H264Settings.builder()
                                                .adaptiveQuantization(H264AdaptiveQuantization.AUTO)
                                                .afdSignaling(AfdSignaling.NONE)
                                                .colorMetadata(H264ColorMetadata.INSERT)
                                                .entropyEncoding(H264EntropyEncoding.CABAC)
                                                .flickerAq(H264FlickerAq.ENABLED)
                                                .forceFieldPictures(H264ForceFieldPictures.DISABLED)
                                                .framerateControl("SPECIFIED")
                                                .framerateNumerator(30000)
                                                .framerateDenominator(1001)
                                                .gopBReference(H264GopBReference.DISABLED)
                                                .gopClosedCadence(1)
                                                .gopSize(90.0)
                                                .gopSizeUnits(H264GopSizeUnits.FRAMES)
                                                .level(H264Level.H264_LEVEL_AUTO)
                                                .lookAheadRateControl(H264LookAheadRateControl.MEDIUM)
                                                .numRefFrames(1)
                                                .parControl(H264ParControl.SPECIFIED)
                                                .profile(H264Profile.MAIN)
                                                .rateControlMode(H264RateControlMode.CBR)
                                                .scanType(H264ScanType.PROGRESSIVE)
                                                .sceneChangeDetect(H264SceneChangeDetect.ENABLED)
                                                .spatialAq(H264SpatialAq.ENABLED)
                                                .subgopLength("FIXED")
                                                .syntax(H264Syntax.DEFAULT)
                                                .temporalAq(H264TemporalAq.ENABLED)
                                                .timecodeInsertion("DISABLED")
                                                .build())
                                        .build())
                                .build())
                .audioDescriptions(
                        AudioDescription.builder()
                                .name("audio_82lool")
                                .audioSelectorName("default")
                                .build(),
                        AudioDescription.builder()
                                .name("audio_l1c2h")
                                .audioSelectorName("default")
                                .build())
                .outputGroups(
                        OutputGroup.builder()
                                .name("LiveStream")
                                .outputGroupSettings(
                                        OutputGroupSettings.builder()
                                                .mediaPackageGroupSettings(
                                                        MediaPackageGroupSettings.builder()
                                                                .destination(
                                                                        OutputLocationRef.builder()
                                                                                .destinationRefId(mediaPackageChannel)
                                                                                .build())
//                                                                .mediaPackageSettings(
//                                                                        MediaPackageSettings.builder()
//                                                                                .channelId(mediaPackageChannelArn)
//                                                                                .build())
                                                                .build())
                                                .build())
                                .outputs(
                                        Output.builder()
                                                .outputName("7iwvon")
                                                .audioDescriptionNames("audio_82lool")
                                                .videoDescriptionName("video_q7t5tl")
                                                .outputSettings(
                                                        OutputSettings.builder()
                                                                .mediaPackageOutputSettings(MediaPackageOutputSettings.builder().build())
                                                                .build())
                                                .build(),
                                        Output.builder()
                                                .outputName("nhgtaj")
                                                .audioDescriptionNames("audio_l1c2h")
                                                .videoDescriptionName("video_d6yva3")
                                                .outputSettings(
                                                        OutputSettings.builder()
                                                                .mediaPackageOutputSettings(MediaPackageOutputSettings.builder().build())
                                                                .build())
                                                .build())
                                .build())
                .build();

        // Create MediaLive Channel
        return mediaLiveClient.createChannel(
                CreateChannelRequest.builder()
                        .name(channelName)
                        .inputAttachments(
                                InputAttachment.builder()
                                        .inputId(inputId)
                                        .inputAttachmentName("LiveStream2")
                                        .inputSettings(
                                                InputSettings.builder()
                                                        .sourceEndBehavior(InputSourceEndBehavior.CONTINUE)
                                                        .filterStrength(1)
                                                        .inputFilter(InputFilter.AUTO)
                                                        .deblockFilter("DISABLED")
                                                        .denoiseFilter("DISABLED")
                                                        .build())
                                        .build())
                        .encoderSettings(encoderSettings)
                        .inputSpecification(
                                InputSpecification.builder()
                                        .codec(InputCodec.AVC)
                                        .maximumBitrate(InputMaximumBitrate.MAX_20_MBPS)
                                        .resolution(InputResolution.HD)
                                        .build())
                      //  .destinations(OutputDestination.builder().id("mediaPackageChannel").build())
                        .destinations(
                                OutputDestination.builder()
                                        .mediaPackageSettings(
                                                MediaPackageOutputDestinationSettings.builder()
                                                      //  .copy().build())
                                                        .channelId(mediaPackageChannel)
                                                        .build())
                                        .id("media-package-destination")
                                        .build())
                        .channelClass(ChannelClass.SINGLE_PIPELINE)
                        .roleArn("arn:aws:iam::************:role/MediaLiveAccessRole")
                        .build());
    }

本文标签: javaUnable to create RTMP MediaLive channel through AWS Lambda functionStack Overflow