'Remove subtitle/caption from hls and dash manifest file

I am currently using aws mediaconvert to encode videos to hls and dash format. I believe that in the m3u8 (for hls) and mpd (for dash) file which is generated, these can be parsed to remove required subtitles. I am looking to parse the m3u8 and mpd file, create an updated manifest without required subtitles and save it back to s3. Has someone previously done something similar?



Solution 1:[1]

This could be done with a Lambda Function triggered by the arrival of the source manifest in a specified S3 bucket. A Lambda script could remove the captions line(s) and post a revised manifest to the different S3 bucket. The script should then copy the segments over to the new bucket as well in order to maintain a playable HLS or DASH file group.

Alternatively you can ingest the asset as-is into MediaPackage as a VOD asset, and use the '?aws.manifestfilter=subtitle_language:xxx' filter when asking for the VOD manifest. This feature of MediaPackage returns a customized (filtered) version of the source manifest on demand without you having to permanently alter it. Specifying a filter of 'subtitle_language:zzz' will return a manifest with no subtitles in it. You could also ask for only specified subtitle renditions to be included.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 aws-rtc