---
title: Ingest HLS Stream into Mediapackage - Best Software Development Team Extension Partner for Nordics
description: Let's give a real life example of Ingest HLS Stream into Mediapackage
image: https://www.craftsmensoftware.com/hubfs/Imported_Blog_Media/Ingest-HLS-Stream-into-Mediapackage.webp
---

[Skip to main content](https://www.craftsmensoftware.com/blog/ingest-hls-stream-into-mediapackage#main-content)

[![Craftsmen-logo](https://www.craftsmensoftware.com/hs-fs/hubfs/Website%202.png?width=200&height=72&name=Website%202.png) ![Craftsmen-logo](https://www.craftsmensoftware.com/hs-fs/hubfs/Website%202.png?width=200&height=72&name=Website%202.png) ![Craftsmen-logo](https://www.craftsmensoftware.com/hs-fs/hubfs/Website%202.png?width=200&height=72&name=Website%202.png) ![Craftsmen-logo](https://www.craftsmensoftware.com/hs-fs/hubfs/Website%202.png?width=200&height=72&name=Website%202.png)](https://www.craftsmensoftware.com)

- [About us](https://www.craftsmensoftware.com/about-us)
- [Client Stories](https://www.craftsmensoftware.com/client-success-stories)
- [How We Work](https://www.craftsmensoftware.com/how-we-work)
- [Case Study](https://www.craftsmensoftware.com/case-study)
- [Blog](https://www.craftsmensoftware.com/blog)
- [Career](https://careers.craftsmensoftware.com/)

Open main navigation

Close main navigation

- [About us](https://www.craftsmensoftware.com/about-us)
- [Client Stories](https://www.craftsmensoftware.com/client-success-stories)
- [How We Work](https://www.craftsmensoftware.com/how-we-work)
- [Case Study](https://www.craftsmensoftware.com/case-study)
- [Blog](https://www.craftsmensoftware.com/blog)
- [Career](https://careers.craftsmensoftware.com/)
- [Get In Touch](https://www.craftsmensoftware.com/contact-us)

[Get In Touch](https://www.craftsmensoftware.com/contact-us)

## Ingest HLS Stream into Mediapackage

![Ingest HLS Stream into Mediapackage](https://www.craftsmensoftware.com/hs-fs/hubfs/Imported_Blog_Media/Ingest-HLS-Stream-into-Mediapackage.webp?width=1200&height=820&name=Ingest-HLS-Stream-into-Mediapackage.webp)

Elemental Mediaconnect -\> Elemental Medialive -\> Elemental Mediapackage

We’ve all seen this workflow before. A tried and tested broadcasting workflow on the AWS cloud. And to be honest, the services work very well together. Recently on a project we’re working on needed something between the encoder(**Medialive**) and the packager(**Mediapackage**) to process segmented video clips before sending it on its way to mediapackage. A simple enough architecture.

![Ingest HLS Stream into Mediapackage](https://www.craftsmensoftware.com/hs-fs/hubfs/Imported_Blog_Media/turuper-tash-300x136.jpg?width=863&height=391&name=turuper-tash-300x136.jpg)

**Medialive** can put files into an **S3** bucket which as you can see here is being used to trigger a **Lambda** that does the processing and sending it to **Mediapackage**.

**Mediapackage** provides you with an HLS ingest endpoint to push your encoded streams to. But we’ve noticed the documentation not mentioning how the stream files need to be sent to the endpoints ([more here](https://docs.aws.amazon.com/mediapackage/latest/ug/gs-ingest-live.html)). Note that the ingest server is a **webDav** server which works great for storing files.

 

We tried making **PUT** requests to the endpoint with the **manifest** and **transport** **stream** as the payload. Strangely enough, we were getting **201** from the server but **Mediapackage** was logging a 401 for every file that we sent despite responding with a **201** externally. And when we try to fetch the packaged **manifest**, we keep getting a **404** back from **Mediapackage** origin endpoint.

 

We couldn’t find any documentation on the expected file name structure that **Mediapackage** requires in order to do its **Just in Time** packaging. Hence this article to help anyone trying to do the same.

 

We were using **Python** as the runtime for our **Lambda** function. The following url is an example **Mediapackage** ingest endpoint.

https://some\_id.mediapackage.some\_region.amazonaws.com/in/v2/some\_id/some\_id/channel

Here’s the function that rewrites our url:

```
def __getIngestUrlForMediaPackage(mediaPackageUrl, fileName):
return f"{mediaPackageUrl}.m3u8" if __isRootManifestFile(fileName) else mediaPackageUrl.replace('channel', fileName)
```

Copy

```

```

 

Turns out for root **manifest**, **Mediapackage** expects the file to be **PUT** into the following endpoint.

https://some\_id.mediapackage.some\_region.amazonaws.com/in/v2/some\_id/some\_id/channel.m3u8

 

And for your **segments** and other **sub** **manifests**, it expects them without the **channel** path.

https://some\_id.mediapackage.some\_region.amazonaws.com/in/v2/some\_id/some\_id/sub\_manifest.m3u8

https://some\_id.mediapackage.some\_region.amazonaws.com/in/v2/some\_id/some\_id/segment.ts

With that set, we can make that coveted **PUT** request to **Mediapackage**.

```
def sendWebDavRequest(webDavRequestVars, fileName, data, headers = {}):
response = requests.put(
    webDavRequestVars["ingestUrl"],
    data=data,
    auth=HTTPDigestAuth(webDavRequestVars["username"], webDavRequestVars["password"]),
    headers=__getHeaderValues(headers)
)
```

 

The header values are not important here. Keep in mind that Mediapackage expects the authentication mechanism to be **HTTPDigestAuth** which[**Python requests**](https://pypi.org/project/requests/) library already exports.

And Voila. We get a working stream.

We’ve tried asking the community at[stackoverflow](https://stackoverflow.com/questions/78389254/ingesting-hls-into-mediapackage) and[aws repost](https://repost.aws/questions/QUnRaRC0puRYOpG1dlpl8bWw/posting-hls-stream-to-aws-mediapackage).

![Sakib Alam](https://www.craftsmensoftware.com/hs-fs/hubfs/MD%20SAKIBUL%20ALAM.png?width=120&height=120&name=MD%20SAKIBUL%20ALAM.png)

Author: **[Sakib Alam](https://www.craftsmensoftware.com/blog/author/sakib-alam)**  
 09/05/2024

![Hire AI-Native Engineers](https://www.craftsmensoftware.com/hubfs/Z63_3132.webp)

## Hire AI-Native Engineers

[![Book A Strategy Call](https://www.craftsmensoftware.com/hubfs/Book%20A%20Strategy%20Call.svg)](https://www.craftsmensoftware.com/contact-us)

### **About Craftsmen**

[The Team](https://www.craftsmensoftware.com/about-us)

[Our Partnership Model](https://www.craftsmensoftware.com/how-we-work)  
[Career](https://careers.craftsmensoftware.com/)

[FAQ](https://www.craftsmensoftware.com/frequently-asked-questions-faq)  
[Privacy Policy](https://www.craftsmensoftware.com/privacy-policy-best-software-development-company-in-bangladesh) 

[Craftsmen LinkedIn Page](https://linkedin.com/company/craftsmensoftware)   [Craftsmen Facebook Page](https://www.facebook.com/craftsmenltd/)   [Craftsmen Youtube Page](https://www.youtube.com/@craftsmensoftware)

### **Headquarter**

**Craftsmen UK**  
One Sovereign Quay, Bridge End, Leeds, West Yorkshire LS1 4AG United Kingdom 

**Operational Hub

Craftsmen Bangladesh**  
Plot # 316, Lane # 4, DOHS Baridhara,

Dhaka - 1206, Bangladesh

### **Sales & Partnership Offices**

**Craftsmen Norway**  
Kong Oscars gate 66, 68, 5017 Bergen, Norway

**Craftsmen France**  
6 Avenue Pierre Grenier, 92100 Boulogne-Billancourt, Paris, France

### **A Team You Can Trust**

#### [![ISO Certificates New](https://www.craftsmensoftware.com/hs-fs/hubfs/ISO%20Certificates%20New.png?width=300&height=96&name=ISO%20Certificates%20New.png)](https://www.craftsmensoftware.com/trust-centre)

[![glassdoor (1)](https://www.craftsmensoftware.com/hs-fs/hubfs/glassdoor%20(1).png?width=110&height=79&name=glassdoor%20(1).png)](https://www.glassdoor.com/Overview/Working-at-Craftsmen-EI_IE3004266.11,20.htm) [![goodfirms.co](https://www.craftsmensoftware.com/hs-fs/hubfs/goodfirms.co.webp?width=110&height=95&name=goodfirms.co.webp)](https://www.craftsmensoftware.com/blog/craftsmen-thrives-at-goodfirms-by-offering-scalable-robust-software-solutions-developed-with-quality-by-maestros)

 

 © 2026 Craftsmen. All rights reserved.

```json
{
  "@context" : "https://schema.org",
  "@type" : "BlogPosting",
  "author" : {
    "@type" : "Person",
    "name" : "Sakib Alam",
    "url" : "https://www.craftsmensoftware.com/blog/author/sakib-alam"
  },
  "dateModified" : "2026-04-30T11:54:01.707Z",
  "datePublished" : "2024-05-08T18:00:00.000Z",
  "headline" : "Ingest HLS Stream into Mediapackage - Best Software Development Team Extension Partner for Nordics",
  "image" : [ "https://www.craftsmensoftware.com/hubfs/Imported_Blog_Media/Ingest-HLS-Stream-into-Mediapackage.webp" ],
  "mainEntityOfPage" : {
    "@id" : "https://www.craftsmensoftware.com/blog/ingest-hls-stream-into-mediapackage",
    "@type" : "WebPage"
  },
  "publisher" : {
    "@type" : "Organization",
    "logo" : {
      "@type" : "ImageObject",
      "url" : "https://www.craftsmensoftware.com/hubfs/Craftsmen%20Logo_Black.png"
    },
    "name" : "Craftsmen Ltd."
  }
}
```

```json
{
  "@context" : "https://schema.org",
  "@type" : "SoftwareCompany",
  "address" : [ {
    "@type" : "PostalAddress",
    "addressCountry" : "Norway",
    "addressLocality" : "Oslo"
  }, {
    "@type" : "PostalAddress",
    "addressCountry" : "United Kingdom",
    "addressLocality" : "London"
  }, {
    "@type" : "PostalAddress",
    "addressCountry" : "France",
    "addressLocality" : "Paris"
  }, {
    "@type" : "PostalAddress",
    "addressCountry" : "United States",
    "addressLocality" : "New York"
  }, {
    "@type" : "PostalAddress",
    "addressCountry" : "Bangladesh",
    "addressLocality" : "Dhaka"
  } ],
  "areaServed" : [ {
    "@type" : "Country",
    "name" : "Norway"
  }, {
    "@type" : "Country",
    "name" : "Sweden"
  }, {
    "@type" : "Country",
    "name" : "United Kingdom"
  }, {
    "@type" : "Country",
    "name" : "France"
  }, {
    "@type" : "Country",
    "name" : "United States"
  }, {
    "@type" : "Country",
    "name" : "Bangladesh"
  } ],
  "description" : "Trusted AI-native engineering partner providing software team extension, IT staff augmentation, and dedicated developer teams globally.",
  "logo" : "https://www.craftsmensoftware.com/hubfs/logo.png",
  "name" : "Craftsmen Software",
  "url" : "https://www.craftsmensoftware.com"
}
```