Filter Options

For Audio, Video, Caption, and Language filter, two filter options, Include (-i) and Include First-Round (-f) can optionally be applied. Filter-options specified between the filter operation (i.e. v) and the parenthetical filter-arguement(s) (i.e. (hdr10)) Filter-options may not be combined, for a given filter.

For Audio and Video filters there is an additional filter option called Protect (-p). If a variant’s CODECS= list contains a “protected” codec, it cannot be removed.

For Video filters there is a filter option called Ordering (-o) which will enable ordering of variants by specified codecs and bitrates.

Option Code Option Name Effect
-i Include Only listed streams are retained
-f Include-First Select the first stream matching any of the listed values, remove the rest.
-p Protect If a variant’s CODECS= list contains a “protected” codec, it cannot be removed.
-o Ordering Modify the order of variants by codec and bitrate

Include Option Example

/v-i(avc,hvc,hdr10)/ would retain AVC, HEVC and HDR-10, and remove other video codes.

Include-First Option Example

/v-f(dvh,hdr10)/, would retain all codecs not listed in the filter values, retain the first stream matching dvh or dhr10, and remove the rest.

As applied to this manifest:

#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=6759875,BANDWIDTH=10022043,VIDEO- RANGE=SDR,CODECS="hvc1.2.4.L123.B0",RESOLUTION=1920x1080,FRAME-RATE=23.976,CLOSED-CAPTIONS=NONE,HDCP- LEVEL=TYPE-0
sdr_1080/prog_index.m3u8
#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=20985770,BANDWIDTH=28058971,VIDEO- RANGE=SDR,CODECS="hvc1.2.4.L150.B0",RESOLUTION=3840x2160,FRAME-RATE=23.976,CLOSED-CAPTIONS=NONE,HDCP- LEVEL=TYPE-1
sdr_2160/prog_index.m3u8
#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=7999361,BANDWIDTH=12876596,VIDEO- RANGE=PQ,CODECS="dvh1.05.03",RESOLUTION=1920x1080,FRAME-RATE=23.976,CLOSED-CAPTIONS=NONE,HDCP-LEVEL=TYPE-0 dolby_1080/prog_index.m3u8
#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=24975091,BANDWIDTH=30041698,VIDEO- RANGE=PQ,CODECS="dvh1.05.06",RESOLUTION=3840x2160,FRAME-RATE=23.976,CLOSED-CAPTIONS=NONE,HDCP-LEVEL=TYPE-1 dolby_2160/prog_index.m3u8
#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=7964551,BANDWIDTH=12886714,VIDEO- RANGE=PQ,CODECS="hvc1.2.4.L123.B0",RESOLUTION=1920x1080,FRAME-RATE=23.976,CLOSED-CAPTIONS=NONE,HDCP- LEVEL=TYPE-0
hdr10_1080/prog_index.m3u8
#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=24833402,BANDWIDTH=29983769,VIDEO- RANGE=PQ,CODECS="hvc1.2.4.L150.B0",RESOLUTION=3840x2160,FRAME-RATE=23.976,CLOSED-CAPTIONS=NONE,HDCP- LEVEL=TYPE-1
hdr10_2160/prog_index.m3u8

The above filter (/v-f(dvh,hdr10)/) would result in:

#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=6759875,BANDWIDTH=10022043,VIDEO- RANGE=SDR,CODECS="hvc1.2.4.L123.B0",RESOLUTION=1920x1080,FRAME-RATE=23.976,CLOSED-CAPTIONS=NONE,HDCP- LEVEL=TYPE-0
sdr_1080/prog_index.m3u8
#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=20985770,BANDWIDTH=28058971,VIDEO- RANGE=SDR,CODECS="hvc1.2.4.L150.B0",RESOLUTION=3840x2160,FRAME-RATE=23.976,CLOSED-CAPTIONS=NONE,HDCP- LEVEL=TYPE-1
sdr_2160/prog_index.m3u8
#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=7999361,BANDWIDTH=12876596,VIDEO- RANGE=PQ,CODECS="dvh1.05.03",RESOLUTION=1920x1080,FRAME-RATE=23.976,CLOSED-CAPTIONS=NONE,HDCP-LEVEL=TYPE-0 dolby_1080/prog_index.m3u8
#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=24975091,BANDWIDTH=30041698,VIDEO- RANGE=PQ,CODECS="dvh1.05.06",RESOLUTION=3840x2160,FRAME-RATE=23.976,CLOSED-CAPTIONS=NONE,HDCP-LEVEL=TYPE-1 dolby_2160/prog_index.m3u8

With HDR10 streams being removed because dvh (Dolby Vision) streams were found, but the non-HDR10 non-DolbyVision streams were not impacted.

Protect Option Examples

/v-p(dvh)/v(dvh,hdr10), will not remove any variants that has the dvh codec in its CODECS= list.

/v-p(avc)/v(avc), the video codec filter for avc is essentially ignored and cancels out.

Ordering Examples

HLS

/v-o(dvh,hdr10:5500-6500:2000-4000)/, will first move all of the dvh variants to the top. hdr10 variants will be listed next, sorted by AVERAGE-BANDWIDTH value that falls within the range 5500-6500, then variants that fall within the range 2000-4000, and then any remaining hdr10 variants.

As applied to this manifest:

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-STREAM-INF:PROGRAM-ID=0,BANDWIDTH=1000,AVERAGE-BANDWIDTH=1000,CODECS="avc1.640020"
http://existing.base/uri/link_1.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=0,BANDWIDTH=1100,AVERAGE-BANDWIDTH=2000,CODECS="avc1.77.30"
http://existing.base/uri/link_2.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=0,BANDWIDTH=4000,AVERAGE-BANDWIDTH=3000,CODECS="hvc1.2.4.L93.90"
http://existing.base/uri/link_3.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=0,BANDWIDTH=4500,AVERAGE-BANDWIDTH=4000,CODECS="dvh1.05.01"
http://existing.base/uri/link_4.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=0,BANDWIDTH=4500,AVERAGE-BANDWIDTH=5000,CODECS="hvc1.1.4.L126.B0"
http://existing.base/uri/link_5.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=0,BANDWIDTH=6000,AVERAGE-BANDWIDTH=6000,CODECS="hvc1.2.4.L93.90"
http://existing.base/uri/link_6.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=0,BANDWIDTH=1500,AVERAGE-BANDWIDTH=7000,CODECS="ec-3"
http://existing.base/uri/link_7.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=0,BANDWIDTH=1300,AVERAGE-BANDWIDTH=8000,CODECS="wvtt"
http://existing.base/uri/link_8.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=0,BANDWIDTH=1300,AVERAGE-BANDWIDTH=1300
http://existing.base/uri/link_9.m3u8

The above filter (/v-o(dvh,hdr10:5500-6500:2000-4000)/) would result in:

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-STREAM-INF:PROGRAM-ID=0,BANDWIDTH=4500,AVERAGE-BANDWIDTH=4000,CODECS="dvh1.05.01"
http://existing.base/uri/link_4.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=0,BANDWIDTH=6000,AVERAGE-BANDWIDTH=6000,CODECS="hvc1.2.4.L93.90"
http://existing.base/uri/link_6.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=0,BANDWIDTH=4000,AVERAGE-BANDWIDTH=3000,CODECS="hvc1.2.4.L93.90"
http://existing.base/uri/link_3.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=0,BANDWIDTH=4500,AVERAGE-BANDWIDTH=5000,CODECS="hvc1.1.4.L126.B0"
http://existing.base/uri/link_5.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=0,BANDWIDTH=1000,AVERAGE-BANDWIDTH=1000,CODECS="avc1.640020"
http://existing.base/uri/link_1.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=0,BANDWIDTH=1100,AVERAGE-BANDWIDTH=2000,CODECS="avc1.77.30"
http://existing.base/uri/link_2.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=0,BANDWIDTH=1500,AVERAGE-BANDWIDTH=7000,CODECS="ec-3"
http://existing.base/uri/link_7.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=0,BANDWIDTH=1300,AVERAGE-BANDWIDTH=8000,CODECS="wvtt"
http://existing.base/uri/link_8.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=0,BANDWIDTH=1300,AVERAGE-BANDWIDTH=1300
http://existing.base/uri/link_9.m3u8

DASH

/v-o(dvh,avc:4000-5000:6000-7000)/, will move the AdaptationSet containing the Representation with the dvh codec to the top first. Then the avc AdaptationSets will be listed next. Every avc AdaptationSet will be sorted individually by its bitrate ranges: 4000-5000 and then 6000-7000.

As applied to this manifest:

<?xml version="1.0" encoding="UTF-8"?>
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011" type="static" mediaPresentationDuration="PT6M16S" minBufferTime="PT1.97S">
  <BaseURL>http://existing.base/url/</BaseURL>
  <Period>
    <AdaptationSet id="0" lang="en" contentType="audio">
      <Representation bandwidth="256" codecs="ac-3" id="0"></Representation>
      <Representation bandwidth="100" codecs="ec-3" id="1"></Representation>
    </AdaptationSet>
    <AdaptationSet id="1" lang="en" maxWidth="960" maxHeight="540" contentType="video">
      <Representation bandwidth="1500" codecs="hvc1.1.4.L126.B0" height="360" id="0" width="640"></Representation>
      <Representation bandwidth="2500" codecs="hvc1.1.4.L126.B0" height="540" id="1" width="960"></Representation>
    </AdaptationSet>
    <AdaptationSet id="2" lang="en" maxWidth="960" maxHeight="540" contentType="video">
      <Representation bandwidth="3500" codecs="avc1.77.30" height="360" id="0" width="640"></Representation>
      <Representation bandwidth="4500" codecs="avc1.77.30" height="540" id="1" width="960"></Representation>
    </AdaptationSet>
    <AdaptationSet id="3" lang="en" maxWidth="960" maxHeight="540" contentType="video">
      <Representation bandwidth="5500" codecs="avc1.77.30" height="360" id="0" width="640"></Representation>
      <Representation bandwidth="6500" codecs="avc1.77.30" height="540" id="1" width="960"></Representation>
    </AdaptationSet>
    <AdaptationSet id="4" lang="en" maxWidth="960" maxHeight="540" contentType="video">
      <Representation bandwidth="7500" codecs="dvh1.05.01" height="360" id="0" width="640"></Representation>
      <Representation bandwidth="8500" codecs="dvh1.05.01" height="540" id="1" width="960"></Representation>
    </AdaptationSet>
  </Period>
</MPD>

The above filter (/v-o(dvh,avc:4000-5000:6000-7000)/) would result in:

<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011" type="static" mediaPresentationDuration="PT6M16S" minBufferTime="PT1.97S">
  <BaseURL>http://existing.base/url/</BaseURL>
  <Period>
    <AdaptationSet id="0" lang="en" contentType="audio">
      <Representation bandwidth="256" codecs="ac-3" id="0"></Representation>
      <Representation bandwidth="100" codecs="ec-3" id="1"></Representation>
    </AdaptationSet>
    <AdaptationSet id="4" lang="en" maxWidth="960" maxHeight="540" contentType="video">
      <Representation bandwidth="7500" codecs="dvh1.05.01" height="360" id="0" width="640"></Representation>
      <Representation bandwidth="8500" codecs="dvh1.05.01" height="540" id="1" width="960"></Representation>
    </AdaptationSet>
    <AdaptationSet id="2" lang="en" maxWidth="960" maxHeight="540" contentType="video">
    <Representation bandwidth="4500" codecs="avc1.77.30" height="540" id="1" width="960"></Representation>
      <Representation bandwidth="3500" codecs="avc1.77.30" height="360" id="0" width="640"></Representation>
    </AdaptationSet>
    <AdaptationSet id="3" lang="en" maxWidth="960" maxHeight="540" contentType="video">
    <Representation bandwidth="6500" codecs="avc1.77.30" height="540" id="1" width="960"></Representation>
      <Representation bandwidth="5500" codecs="avc1.77.30" height="360" id="0" width="640"></Representation>
    </AdaptationSet>
    <AdaptationSet id="1" lang="en" maxWidth="960" maxHeight="540" contentType="video">
      <Representation bandwidth="1500" codecs="hvc1.1.4.L126.B0" height="360" id="0" width="640"></Representation>
      <Representation bandwidth="2500" codecs="hvc1.1.4.L126.B0" height="540" id="1" width="960"></Representation>
    </AdaptationSet>
  </Period>
</MPD>