Azure-Samples / media-services-v3-dotnet

The projects in this repository show how to implement different Azure Media Services scenarios using the v3 version.
MIT License
58 stars 52 forks source link

Dynamic packaging filters by track name do not work #122

Open bragma opened 1 year ago

bragma commented 1 year ago

Please provide us with the following information:

This issue is for a: (mark with an x)

- [X] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Hi, I am trying to create an account filter to remove tracks with a specified name (to be exact, I am trying to remove tracks with 50 fps frame rate, in my case they have frame rate specified in the name). Here is the list of tracks in my asset:

image

I am using this code:

mediaServicesAccount.GetMediaServicesAccountFilters().CreateOrUpdateAsync(
    Azure.WaitUntil.Completed,
    "remove50fps",
    new MediaServicesAccountFilterData
    {
        Tracks =
        {
            new FilterTrackSelection(
                trackSelections: new List<FilterTrackPropertyCondition>
                {
                    new FilterTrackPropertyCondition(
                        FilterTrackPropertyType.Name,
                        "Video-6000-50-1920x1080-6000.mp4_1",
                        FilterTrackPropertyCompareOperation.NotEqual
                    )
                }
            )
        }
    });

Any log messages given by the failure

No error messages are given and the filter is created.

Expected/desired behavior

Track with index 0 (corresponding to the filtered out track) should not be present in the filtered manifest. There should be 8 tracks in the manifest, out of 9 total tracks in the manifest.

This is the manifest without the filter:

https://XXXXX/Sequence_07.ism/manifest

<?xml version="1.0" encoding="UTF-8"?>
<SmoothStreamingMedia MajorVersion="2" MinorVersion="2" Duration="106000000" TimeScale="10000000">
    <StreamIndex Chunks="6" Type="video" Url="QualityLevels({bitrate})/Fragments(video={start time})" QualityLevels="9">
        <QualityLevel Index="0" Bitrate="6060727" FourCC="H264" MaxWidth="1920" MaxHeight="1080" CodecPrivateData="000000016764002AACD940780227E59A808080A0000003002000000C91E30632C00000000168E93B2C8B" />
        <QualityLevel Index="1" Bitrate="4591870" FourCC="H264" MaxWidth="1920" MaxHeight="1080" CodecPrivateData="0000000167640028ACD940780227E59A808080A0000003002000000651E30632C00000000168E93B2C8B" />
        <QualityLevel Index="2" Bitrate="4440969" FourCC="H264" MaxWidth="1280" MaxHeight="720" CodecPrivateData="0000000167640020ACD9405005BA6A020202800000030080000032478C18CB0000000168E93B2C8B" />
        <QualityLevel Index="3" Bitrate="3363752" FourCC="H264" MaxWidth="1280" MaxHeight="720" CodecPrivateData="000000016764001FACD9405005BA6A020202800000030080000019478C18CB0000000168E93B2C8B" />
        <QualityLevel Index="4" Bitrate="2245569" FourCC="H264" MaxWidth="960" MaxHeight="540" CodecPrivateData="000000016764001FACD940F0117EE6A02020280000030008000003019478C18CB00000000168E93B2C8B" />
        <QualityLevel Index="5" Bitrate="1486577" FourCC="H264" MaxWidth="960" MaxHeight="540" CodecPrivateData="000000016764001FACD940F0117EE6A02020280000030008000003019478C18CB00000000168E93B2C8B" />
        <QualityLevel Index="6" Bitrate="988225" FourCC="H264" MaxWidth="640" MaxHeight="360" CodecPrivateData="000000016764001EACD940A02FF966A02020280000030008000003019478B16CB00000000168E93B2C8B" />
        <QualityLevel Index="7" Bitrate="638526" FourCC="H264" MaxWidth="640" MaxHeight="360" CodecPrivateData="000000016764001EACD940A02FF966A02020280000030008000003019478B16CB00000000168E93B2C8B" />
        <QualityLevel Index="8" Bitrate="372253" FourCC="H264" MaxWidth="320" MaxHeight="180" CodecPrivateData="000000016764000DACD941419F9E6A020202800000030080000019478A14CB0000000168E93B2C8B" />
        <c t="0" d="20000000" r="5" />
        <c d="6000000" />
    </StreamIndex>
</SmoothStreamingMedia>

The filtered manifest is the same. This is the manifest with the filter applied:

https://XXXXX/Sequence_07.ism/manifest/manifest(filter=remove50fps)

<?xml version="1.0" encoding="UTF-8"?>
<SmoothStreamingMedia MajorVersion="2" MinorVersion="2" Duration="106000000" TimeScale="10000000">
    <StreamIndex Chunks="6" Type="video" Url="QualityLevels({bitrate})/Fragments(video={start time})" QualityLevels="9">
        <QualityLevel Index="0" Bitrate="6060727" FourCC="H264" MaxWidth="1920" MaxHeight="1080" CodecPrivateData="000000016764002AACD940780227E59A808080A0000003002000000C91E30632C00000000168E93B2C8B" />
        <QualityLevel Index="1" Bitrate="4591870" FourCC="H264" MaxWidth="1920" MaxHeight="1080" CodecPrivateData="0000000167640028ACD940780227E59A808080A0000003002000000651E30632C00000000168E93B2C8B" />
        <QualityLevel Index="2" Bitrate="4440969" FourCC="H264" MaxWidth="1280" MaxHeight="720" CodecPrivateData="0000000167640020ACD9405005BA6A020202800000030080000032478C18CB0000000168E93B2C8B" />
        <QualityLevel Index="3" Bitrate="3363752" FourCC="H264" MaxWidth="1280" MaxHeight="720" CodecPrivateData="000000016764001FACD9405005BA6A020202800000030080000019478C18CB0000000168E93B2C8B" />
        <QualityLevel Index="4" Bitrate="2245569" FourCC="H264" MaxWidth="960" MaxHeight="540" CodecPrivateData="000000016764001FACD940F0117EE6A02020280000030008000003019478C18CB00000000168E93B2C8B" />
        <QualityLevel Index="5" Bitrate="1486577" FourCC="H264" MaxWidth="960" MaxHeight="540" CodecPrivateData="000000016764001FACD940F0117EE6A02020280000030008000003019478C18CB00000000168E93B2C8B" />
        <QualityLevel Index="6" Bitrate="988225" FourCC="H264" MaxWidth="640" MaxHeight="360" CodecPrivateData="000000016764001EACD940A02FF966A02020280000030008000003019478B16CB00000000168E93B2C8B" />
        <QualityLevel Index="7" Bitrate="638526" FourCC="H264" MaxWidth="640" MaxHeight="360" CodecPrivateData="000000016764001EACD940A02FF966A02020280000030008000003019478B16CB00000000168E93B2C8B" />
        <QualityLevel Index="8" Bitrate="372253" FourCC="H264" MaxWidth="320" MaxHeight="180" CodecPrivateData="000000016764000DACD941419F9E6A020202800000030080000019478A14CB0000000168E93B2C8B" />
        <c t="0" d="20000000" r="5" />
        <c d="6000000" />
    </StreamIndex>
</SmoothStreamingMedia>

Versions

Azure Media Services v3 Azure.ResourceManager.Media 1.1.0

Mention any other details that might be useful

Filters based on other conditions (ex: bitrate) do work.

If I invert the condition (FilterTrackPropertyCompareOperation.Equal), all tracks are removed. I suspect something is wrong with the track name value used in comparison.

xpouyat commented 1 year ago

Hello, I think the problem is that you are using a track property in the filter while you want to filter on a specific quality/bitrate. Tracks are named tracks in the asset, but for the filter, all the bitrates/quality levels are considered as one track.

In your case, I think you should use the bitrate property, not track name. But I hope the higher bitrate is the one you want to remove. If bitrates are really different per asset, it could be difficult to find the right upper limit for the bitrate to filter. In that case, you may have to use asset filters to have a customized filter per asset. Or use a combination of asset and account filters with the same name. I think the asset filter will have higher priority (to be tested)

bragma commented 1 year ago

Hi, thanks for answering. That's not what I want to do. I want to remove a specific track using the name of the track itself. But just to be sure, what's the purpose of the name filter and how it is supposed to be used?

xpouyat commented 1 year ago

The purpose of the name filter is to remove a track, commonly an audio track. If you have two audio tracks. For example, one english and one french audio track and want to remove one language. Or one stereo audio track and one AC-3 track and want to remove ac-3 because a device does not support it. In your case, you have one video track (with several qualities) in the context of a filter.

bragma commented 1 year ago

Hi @xpouyat, sorry if I reiterate on your answer. I think that both scenarios you mention make sense, but are already covered by the "fourCC" and "Language" condition. I think that removing a specific stereo/AC-3 audio track can be done with the "fourCC" condition rule. Removing the language can be done with the specific "Language" condition. Both work and are fine for that purpose. But I am specifically asking for the "Name" condition, which I think does not work or at least it's not clear what's the name it compaers with. Also, I cannot find any examples on its use it or who to report a bug.

xpouyat commented 1 year ago

You can create a ticket in Azure portal from https://azure.microsoft.com/en-us/support/create-ticket It should guide you to https://portal.azure.com/#blade/Microsoft_Azure_Support/HelpAndSupportBlade Cheers