Expand description

manifest-filter is a lib used to modify video manifests.

Table of contents

Features

  • Modify master playlists (filter variants by bandwidth, fps, etc)
  • Modify media playlists (DVR, trim segments)

More features are coming soon.

Examples

You can try the example below, used to filter only the variants that are 30fps.

use manifest_filter::Master;
use std::io::Read;

let mut file = std::fs::File::open("manifests/master.m3u8").unwrap();
let mut content: Vec<u8> = Vec::new();
file.read_to_end(&mut content).unwrap();

let (_, master_playlist) = m3u8_rs::parse_master_playlist(&content).unwrap();
let mut master = Master {
    playlist: master_playlist,
};
master.filter_fps(Some(30.0));

The result should be something like this

#EXTM3U
#EXT-X-VERSION:4
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio-aach-96",LANGUAGE="en",NAME="English",DEFAULT=YES,AUTOSELECT=YES,CHANNELS="2"
#EXT-X-STREAM-INF:BANDWIDTH=600000,AVERAGE-BANDWIDTH=600000,CODECS="mp4a.40.5,avc1.64001F",RESOLUTION=384x216,FRAME-RATE=30,AUDIO="audio-aach-96",CLOSED-CAPTIONS=NONE
variant-audio_1=96000-video=249984.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=800000,AVERAGE-BANDWIDTH=800000,CODECS="mp4a.40.5,avc1.64001F",RESOLUTION=768x432,FRAME-RATE=30,AUDIO="audio-aach-96",CLOSED-CAPTIONS=NONE
variant-audio_1=96000-video=1320960.m3u8

All functions can be chained. Call filter_fps to first remove variants with a frame rate different of the one choosen and call filter_bandwith right after to remove variants thare don’t fit into the max/min range expected. The sampe applies for Media.

Structs

Master holds a reference to the master playlist. All functions implemented by this struct can be chained.
Media holds a reference to the media playlist. All functions implemented by this struct can be chained.

Functions