Element Remove

You can activate this plugin with the string manifest_edit.plugins.mpd.element_remove.

The Element Remove plugin allows you to remove any Period, Adaptation Set or Representation from a Dash manifest (see 5.8.4.9 of ISO23009-1 standard).

Some usage examples include removing a track (representation) with a specific bandwidth, or a subtitle (adaptation_set) with a given mimeType.

This plugin uses the same "select and edit" approach shared by many others. The "selection" syntax used in Element Remove is common to many other plugins and is described in the following dedicated chapter.

Element Remove configuration

Once you have selected the elements to remove, it's just a matter to specify the "remove" action. This is achieved with the following syntax:

remove: 'this'

Having in mind the two examples cited in the introduction, the right configuration to remove video tracks with a given bandwidth would be:

mpd:
- manifest_edit.plugins.mpd.element_remove:
    periods:
      - '*' : '.*'
        adaptationSets:
          - contentType : 'video'
            representations:
              - bandwidth: '401000'
                plugin_config:
                  remove: 'this'
              - bandwidth: '2200000'
                plugin_config:
                  remove: 'this'

Warning

If the configuration matches all representations in the given adaptation_set, the manifest is still edited according to the configuration, but a warning message is emitted, as this would leave an empty adaptation_set. Instead a configuration should be used to remove the entire adaptation_set (if this is intended).

The following configuration can be used instead to remove an adaptation set with a particular codec:

mpd:
- manifest_edit.plugins.mpd.element_remove:
    periods:
      - '*' : '.*'
        adaptationSets:
          - codecs: 'hvc.*'
            plugin_config:
              remove: 'this'

As in all plugins making use of the "Element Selection" syntax, you can specify multiple selection keys for an element to remove. The following example removes only those tracks with an "audio" contentType and a specific language:

mpd:
- manifest_edit.plugins.mpd.element_remove:
    periods:
      - '*' : '.*'
        adaptationSets:
          - contentType : 'audio'
            lang: 'en'
            plugin_config:
              remove: 'this'

When removing an element from the manifest, the element_remove plugin will perform some basic coherence checks to make sure that the output manifest is correct. In particular, when removing representations from an adaptation sets, the following fields will be checked and automatically updated:

  • minBandwidth/maxBandwidth

  • minWidth/maxWidth

  • minHeight/maxHeight

  • minFramerate/maxFramerate.

You can find additional examples of configuration in the Included Use Cases chapter.