Azure Media Services v3 create asset filter returns BadRequest.
Both code and manifest are included below. Asset duration is 00:00:26.4330000
Have tried adjusting the tracks, no tracks. Have tried adjusting the time parameters.
Any ideas on what is wrong?
Is it possible for the API to report more information on what is wrong?
Can a sample be created that shows how to use AssetFilters.CreateOrUpdate with and without track filters?
Code
var timingData = GetManifestTimingData(new Uri(asset.ManifestUrl));
Log.Info($"Timescale: {timingData.TimeScale} Offset: {timingData.TimestampOffset} clip: ( {TimeSpan.FromSeconds(startTimeSec)} - {TimeSpan.FromSeconds(endTimeSec)} ) as ( {TimeSpan.FromSeconds(startTimeSec)} to {TimeSpan.FromSeconds(endTimeSec)} ) {name} ----- {asset.ToAssetInfo()?.hashKey} {asset.Name} -- Manifest: {asset.PlaybackUrl}");
if (startTimeSec >= timingData.AssetDuration.TotalSeconds)
{
Log.Error($"Invalid start time: {startTimeSec} > {timingData.AssetDuration}");
return null;
}
if (endTimeSec >= timingData.AssetDuration.TotalSeconds)
{
endTimeSec = (int)Math.Floor(timingData.AssetDuration.TotalSeconds);
}
var startTimeSpan = timingData.OffSetAsTimeSpan + TimeSpan.FromSeconds(startTimeSec);
var endTimeSpan = timingData.OffSetAsTimeSpan + TimeSpan.FromSeconds(endTimeSec);
double timeScale = timingData.TimeScale ?? TimeSpan.TicksPerSecond;
var scaledStartTime = Convert.ToInt64(Math.Truncate(startTimeSpan.Ticks * (timeScale / TimeSpan.TicksPerSecond)));
var scaledEndTime = Convert.ToInt64(Math.Truncate(endTimeSpan.Ticks * (timeScale / TimeSpan.TicksPerSecond)));
var range = new PresentationTimeRange(scaledStartTime, scaledEndTime, 9223372036854775807, 0, (long)timeScale, false);
var tracks = new List<FilterTrackSelection>
{
new FilterTrackSelection(new List<FilterTrackPropertyCondition>
{
new FilterTrackPropertyCondition(FilterTrackPropertyType.Type, "Audio", FilterTrackPropertyCompareOperation.Equal),
}),
new FilterTrackSelection(new List<FilterTrackPropertyCondition>
{
new FilterTrackPropertyCondition(FilterTrackPropertyType.Type, "Video", FilterTrackPropertyCompareOperation.Equal),
}),
};
var firstQuality = new FirstQuality(128000);
var filterParams = new AssetFilter(null, name, FilterType, range, firstQuality, tracks);
var filter = _client.AssetFilters.CreateOrUpdate(ResourceGroup, AccountName, asset.Id, name, filterParams);
if (filter == null)
{
Log.Warn($"Failed to create filter {name} in {asset}");
return null;
}
return filter;
Manifest
<SmoothStreamingMedia MajorVersion="2" MinorVersion="2" Duration="264333333" TimeScale="10000000">
<StreamIndex Chunks="13" Type="video" Url="QualityLevels({bitrate})/Fragments(video={start time})" QualityLevels="1">
<QualityLevel Index="0" Bitrate="770760" FourCC="H264" MaxWidth="1280" MaxHeight="720" CodecPrivateData="000000016764001FACD9405005BA10000003001000000303C0F18319600000000168EBECB22C" />
<c t="0" d="20333333" r="2" />
<c d="20333334" />
<c d="20333333" r="2" />
<c d="20333334" />
<c d="20333333" r="2" />
<c d="20333334" />
<c d="20333333" r="2" />
<c d="20333334" />
<c d="20333333" />
</StreamIndex>
<StreamIndex Chunks="14" Type="audio" Url="QualityLevels({bitrate})/Fragments(aac_UND_2_127999={start time})" QualityLevels="1" Name="aac_UND_2_127999">
<QualityLevel AudioTag="255" Index="0" BitsPerSample="16" Bitrate="127999" FourCC="AACL" CodecPrivateData="1190" Channels="2" PacketSize="4" SamplingRate="48000" />
<c t="0" d="20053333" r="2" />
<c d="20053334" />
<c d="20053333" r="2" />
<c d="20053334" />
<c d="20053333" r="2" />
<c d="20053334" />
<c d="20053333" r="2" />
<c d="20053334" />
<c d="20053333" />
<c d="3626667" />
</StreamIndex>
<Protection>
<ProtectionHeader SystemID="B47B251A-2409-4B42-958E-08DBAE7B4EE9">
<ContentProtection schemeIdUri="urn:mpeg:dash:sea:2012" xmlns:sea="urn:mpeg:dash:schema:sea:2012">
<sea:SegmentEncryption schemeIdUri="urn:mpeg:dash:sea:aes128-cbc:2013" />
<sea:KeySystem keySystemUri="urn:mpeg:dash:sea:keysys:http:2013" />
<sea:CryptoPeriod IV="0xF6BCAD06C97D0FEC81B702C86183355B" keyUriTemplate="https://testurstream.keydelivery.westus.media.azure.net?kid=d6c1f008-d43f-4c60-926f-76ba613b7b4b" />
</ContentProtection>
</ProtectionHeader>
</Protection>
</SmoothStreamingMedia>