Per Title and AES Encryption is not working

I am getting below issue while doing per title encoding with cenc drm.

{Bitmovin.Api.Sdk.Common.BitmovinApiException: Invalid ‘CENC’ DRM: Output path “/audio/” on AZURE is already used by Muxing d8c28d0a-7b32-4014-b10d-871d5b445295. Choose a different output location.
errorCode: 1001
request:
method: POST
url: https://api.bitmovin.com/v1/encoding/encodings/2793635d-7342-4b1f-a500-7aa9a0c6bcbd/start
body: {“vodDashManifests”:[{“manifestId”:“a3a9e623-e0b9-4974-a4f9-6b25d7cc5953”}],“manifestGenerator”:“V2”,“perTitle”:{“h264Configuration”:{“autoRepresentations”:{}}}}
response:
httpStatusCode: 400
body: {“requestId”:“9bc019b3-286f-4b59-a561-501d1a3d88be”,“status”:“ERROR”,“data”:{“code”:1001,“message”:“Invalid ‘CENC’ DRM: Output path "/audio/" on AZURE is already used by Muxing d8c28d0a-7b32-4014-b10d-871d5b445295. Choose a different output location.”,“developerMessage”:“Invalid ‘CENC’ DRM: Output path "/audio/" on AZURE is already used by Muxing d8c28d0a-7b32-4014-b10d-871d5b445295. Choose a different output location.”}}

at Bitmovin.Api.Sdk.Common.Http.ErrorHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
at RestEase.Implementation.Requester.SendRequestAsync(IRequestInfo requestInfo, Boolean readBody)
at RestEase.Implementation.Requester.RequestAsync[T](IRequestInfo requestInfo)
at Bitmovin.Api.Sdk.Encoding.Encodings.EncodingsApi.StartAsync(String encodingId, StartEncodingRequest startEncodingRequest)
at spherexratingswatermarkingapi.Utils.BitMovinPerTitleEncoding.ExecuteEncoding(Encoding encoding, StartEncodingRequest startEncodingRequest) in D:\Projects\ratings-ratingspro-azure\spherexratingswatermarkingapi\Encoding\BitMovinPerTitleEncoding.cs:line 284
at spherexratingswatermarkingapi.Utils.BitMovinPerTitleEncoding.PerTitleEncoding() in D:\Projects\ratings-ratingspro-azure\spherexratingswatermarkingapi\Encoding\BitMovinPerTitleEncoding.cs:line 100}

My code are as below

public async Task PerTitleEncoding()
{
_bitmovinApi = BitmovinApi.Builder
.WithApiKey(Constants.config.BitmovinAPIKey)
.WithLogger(new ConsoleLogger())
.Build();
var encoding = CreateEncoding(“Per-Title encoding”, “Per-Title encoding with HLS and DASH manifest-1”).GetAwaiter().GetResult();
try
{

            var input = CreateAzureInput(Constants.storageName, Constants.AccountKey, "asset-424c1338-d4f2-4ee3-a160-685c3a45a420").GetAwaiter().GetResult();
            var output =  await CreateAzureOutput(Constants.storageName, Constants.AccountKey, "asset-0d0d50bf-a80a-4f8e-b0b8-036f6bef6ab5");
            JobId = encoding.Id;


            var filters = new List<Filter>()
        {
            await CreateTextFilter()
        };

            var inputFilePath = Constants.filename;
            KeyId = DRMKeyGenerator.GetRandomKey(32);
            KeySecret = DRMKeyGenerator.GetRandomKey(32);
            // Add an H.264 video stream to the encoding
            var h264VideoConfig = await CreateH264VideoConfiguration();
            var h264VideoStream = await CreateStream(encoding, input, inputFilePath, h264VideoConfig, StreamMode.PER_TITLE_TEMPLATE);

            // Add an AAC audio stream to the encoding
            var aacConfig = await CreateAacAudioConfiguration();
            var aacAudioStream = await CreateStream(encoding, input, inputFilePath, aacConfig, StreamMode.STANDARD);

            if (Constants.watermarkString != null)
            {
                await CreateStreamFilterList(encoding, h264VideoStream, filters);
            }

        //   var videoMuxing = await CreateFmp4MuxingNew(encoding, h264VideoStream);
         //  var audioMuxing = await CreateFmp4MuxingNew(encoding, aacAudioStream);

            var videoMuxing =  CreateFmp4Muxing(encoding, output, "/video/{height}/{bitrate}_{uuid}", h264VideoStream).GetAwaiter().GetResult();
            var audioMuxing = CreateFmp4Muxing(encoding, output, $"/audio", aacAudioStream).GetAwaiter().GetResult();



            CreateDrmConfig(encoding, videoMuxing, output, "video/{height}/{bitrate}_{uuid}").GetAwaiter().GetResult();
            CreateDrmConfig(encoding, audioMuxing, output, $"/audio").GetAwaiter().GetResult();

            var dashManifest = await CreateDefaultDashManifest(encoding, output, "/");


            var startEncodingRequest = new StartEncodingRequest()
            {
                PerTitle = new PerTitle()
                {
                    H264Configuration = new H264PerTitleConfiguration()
                    {
                        AutoRepresentations = new AutoRepresentation()
                    }
                },
                ManifestGenerator = ManifestGenerator.V2,
                VodDashManifests = new List<ManifestResource>() { BuildManifestResource(dashManifest) },
            };
            await ExecuteEncoding(encoding, startEncodingRequest);
            return encoding.Id;
        }
        catch(Exception ex)
        {
            LogHelper.LogError(ex, Constants.Asset_ID, Constants.ApplicationId, ex.Message.ToString());
        }
        return encoding.Id;
   

    }

Thanks for reaching out

For the issue above –

                var videoMuxing =  CreateFmp4Muxing(encoding, output, "/video/{height}/{bitrate}_{uuid}", h264VideoStream).GetAwaiter().GetResult();

                var audioMuxing = CreateFmp4Muxing(encoding, output, $"/audio", aacAudioStream).GetAwaiter().GetResult();

  

                CreateDrmConfig(encoding, videoMuxing, output, "video/{height}/{bitrate}_{uuid}").GetAwaiter().GetResult();

                CreateDrmConfig(encoding, audioMuxing, output, $"/audio").GetAwaiter().GetResult();

I see you’re creating BOTH clear and DRMed outputs to the same location.
A) If your intent is to output BOTH the clear and DRMed contents - kindly output them to different locations
– OR –
B) If your intent is to output ONLY the DRMed contents - you can omit the output in the clear videoMuxing and audioMuxing.

Hope that clarifies.