Hello folks,

I have the following HLS structure given:
![root](https://user-images.githubusercontent.com/43114687/180177379-20ecad63-71b2-49f0-bf72-c28c044c3b37.png)

Within each folder, I have such a structure:
![sub](https://user-images.githubusercontent.com/43114687/180177426-8261a77c-b50a-48c7-9199-0a1bdcf88ddd.png)

As you can maybe already imagine, I only have HLS in use. Now I also wanted to have Dash compatibility, so I started to convert the master.m3u8 on each subfolder like so:

`MP4Box -mpd master.m3u8 -out master.mpd`

Awesome, now I have a mpd file that basically references the m3u8 playlist. But why referencing, why not simply generate an independent mpd file from the m3u8 that references the m4s/ts segments directly?

This is the m3u8 I use as input:

```

#EXTM3U
#EXT-X-VERSION:7
#EXT-X-TARGETDURATION:9
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-MAP:URI="init-a-aac-de-mp4a.40.2_128000.m4s"
#EXTINF:9.002667,
f-0000.m4s
#EXTINF:1.056000,
f-0001.m4s
#EXT-X-ENDLIST
```

This is what I get in return:

```
<MPD type="static" xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:hls="urn:gpac:hls:aes:mpd:2015" profiles="urn:mpeg:dash:profile:full:2011" id="master.m3u8" mediaPresentationDuration="PT9S" minBufferTime="PT1.5S">
 <ProgramInformation moreInformationURL="http://gpac.sourceforge.net">
  <Title>master.m3u8</Title>
  <Source>Generated from URL master.m3u8</Source>
  <Copyright>Generated by GPAC 0.5.2-DEV-revVersion: 0.5.2-426-gc5ad4e4+dfsg5-5 from master.m3u8</Copyright>
 </ProgramInformation>
 <Period start="PT0S" duration="PT9S" >
  <AdaptationSet segmentAlignment="true">
  </AdaptationSet>
 </Period>
</MPD>
```

I'm not sure how compatible such an output is, can somebody give an advice here?

This was the first "issue", if it's really an issue in the end...
The second problem I have is at the master.m3u8 file at the root directory of my HLS structure.
The file looks like this:

```
#EXTM3U
#EXT-X-VERSION:7
#EXT-X-PLAYLIST-TYPE VOD

#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="a-0",NAME="Deutsch",CHANNELS="2",AUTOSELECT="YES",DEFAULT="NO",LANGUAGE="de",URI="a-eac3-de-ec-3_224000/master.m3u8"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="a-0",NAME="English",CHANNELS="2",AUTOSELECT="YES",DEFAULT="NO",LANGUAGE="en",URI="a-eac3-en-ec-3_224000/master.m3u8"

#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="a-3",NAME="English",CHANNELS="2",AUTOSELECT="YES",DEFAULT="NO",LANGUAGE="en",URI="a-aac-en-mp4a.40.2_256000/master.m3u8"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="a-3",NAME="Deutsch",CHANNELS="2",AUTOSELECT="YES",DEFAULT="NO",LANGUAGE="de",URI="a-aac-de-mp4a.40.2_256000/master.m3u8"

#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="a-4",NAME="English",CHANNELS="2",AUTOSELECT="YES",DEFAULT="NO",LANGUAGE="en",URI="a-aac-en-mp4a.40.2_128000/master.m3u8"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="a-4",NAME="Deutsch",CHANNELS="2",AUTOSELECT="YES",DEFAULT="NO",LANGUAGE="de",URI="a-aac-de-mp4a.40.2_128000/master.m3u8"

#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="a-5",NAME="English",CHANNELS="2",AUTOSELECT="YES",DEFAULT="NO",LANGUAGE="en",URI="a-aac_he-en-mp4a.40.5_96000/master.m3u8"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="a-5",NAME="Deutsch",CHANNELS="2",AUTOSELECT="YES",DEFAULT="NO",LANGUAGE="de",URI="a-aac_he-de-mp4a.40.5_96000/master.m3u8"

#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="a-6",NAME="English",CHANNELS="2",AUTOSELECT="YES",DEFAULT="NO",LANGUAGE="en",URI="a-aac_he_v2-en-mp4a.40.5_64000/master.m3u8"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="a-6",NAME="Deutsch",CHANNELS="2",AUTOSELECT="YES",DEFAULT="NO",LANGUAGE="de",URI="a-aac_he_v2-de-mp4a.40.5_64000/master.m3u8"


#EXT-X-STREAM-INF:BANDWIDTH="1976550",RESOLUTION=640x456,CODECS="avc1.42001f,ec-3",AUDIO="a-0"
v-h264-480p-avc1.42001f/master.m3u8

#EXT-X-STREAM-INF:BANDWIDTH="2011750",RESOLUTION=640x456,CODECS="avc1.42001f,mp4a.40.2",AUDIO="a-3"
v-h264-480p-avc1.42001f/master.m3u8

#EXT-X-STREAM-INF:BANDWIDTH="1870950",RESOLUTION=640x456,CODECS="avc1.42001f,mp4a.40.2",AUDIO="a-4"
v-h264-480p-avc1.42001f/master.m3u8

#EXT-X-STREAM-INF:BANDWIDTH="1835750",RESOLUTION=640x456,CODECS="avc1.42001f,mp4a.40.5",AUDIO="a-5"
v-h264-480p-avc1.42001f/master.m3u8

#EXT-X-STREAM-INF:BANDWIDTH="1800550",RESOLUTION=640x456,CODECS="avc1.42001f,mp4a.40.5",AUDIO="a-6"
v-h264-480p-avc1.42001f/master.m3u8

```

If I run the MP4box command from above against this m3u8 file I get back the following error:
```

MP4Box -mpd master.m3u8 -out master.mpd
MP4Box: media_tools/m3u8.c:752: declare_sub_playlist: Assertion `0' failed.
Aborted
```

Can somebody help? How can I convert my HLS to a Dash structure?

Thanks in advance
How can I convert a m3u8 file to mpd?
This is a GitHub Issue
repo:gpac
owner:gpac
Title : How can I convert a m3u8 file to mpd?
Issue date:

--- start body ---
Hello folks,

I have the following HLS structure given:
![root](https://user-images.githubusercontent.com/43114687/180177379-20ecad63-71b2-49f0-bf72-c28c044c3b37.png)

Within each folder, I have such a structure:
![sub](https://user-images.githubusercontent.com/43114687/180177426-8261a77c-b50a-48c7-9199-0a1bdcf88ddd.png)

As you can maybe already imagine, I only have HLS in use. Now I also wanted to have Dash compatibility, so I started to convert the master.m3u8 on each subfolder like so:

`MP4Box -mpd master.m3u8 -out master.mpd`

Awesome, now I have a mpd file that basically references the m3u8 playlist. But why referencing, why not simply generate an independent mpd file from the m3u8 that references the m4s/ts segments directly?

This is the m3u8 I use as input:

```

#EXTM3U
#EXT-X-VERSION:7
#EXT-X-TARGETDURATION:9
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-MAP:URI="init-a-aac-de-mp4a.40.2_128000.m4s"
#EXTINF:9.002667,
f-0000.m4s
#EXTINF:1.056000,
f-0001.m4s
#EXT-X-ENDLIST
```

This is what I get in return:

```
<MPD type="static" xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:hls="urn:gpac:hls:aes:mpd:2015" profiles="urn:mpeg:dash:profile:full:2011" id="master.m3u8" mediaPresentationDuration="PT9S" minBufferTime="PT1.5S">
 <ProgramInformation moreInformationURL="http://gpac.sourceforge.net">
  <Title>master.m3u8</Title>
  <Source>Generated from URL master.m3u8</Source>
  <Copyright>Generated by GPAC 0.5.2-DEV-revVersion: 0.5.2-426-gc5ad4e4+dfsg5-5 from master.m3u8</Copyright>
 </ProgramInformation>
 <Period start="PT0S" duration="PT9S" >
  <AdaptationSet segmentAlignment="true">
  </AdaptationSet>
 </Period>
</MPD>
```

I'm not sure how compatible such an output is, can somebody give an advice here?

This was the first "issue", if it's really an issue in the end...
The second problem I have is at the master.m3u8 file at the root directory of my HLS structure.
The file looks like this:

```
#EXTM3U
#EXT-X-VERSION:7
#EXT-X-PLAYLIST-TYPE VOD

#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="a-0",NAME="Deutsch",CHANNELS="2",AUTOSELECT="YES",DEFAULT="NO",LANGUAGE="de",URI="a-eac3-de-ec-3_224000/master.m3u8"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="a-0",NAME="English",CHANNELS="2",AUTOSELECT="YES",DEFAULT="NO",LANGUAGE="en",URI="a-eac3-en-ec-3_224000/master.m3u8"

#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="a-3",NAME="English",CHANNELS="2",AUTOSELECT="YES",DEFAULT="NO",LANGUAGE="en",URI="a-aac-en-mp4a.40.2_256000/master.m3u8"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="a-3",NAME="Deutsch",CHANNELS="2",AUTOSELECT="YES",DEFAULT="NO",LANGUAGE="de",URI="a-aac-de-mp4a.40.2_256000/master.m3u8"

#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="a-4",NAME="English",CHANNELS="2",AUTOSELECT="YES",DEFAULT="NO",LANGUAGE="en",URI="a-aac-en-mp4a.40.2_128000/master.m3u8"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="a-4",NAME="Deutsch",CHANNELS="2",AUTOSELECT="YES",DEFAULT="NO",LANGUAGE="de",URI="a-aac-de-mp4a.40.2_128000/master.m3u8"

#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="a-5",NAME="English",CHANNELS="2",AUTOSELECT="YES",DEFAULT="NO",LANGUAGE="en",URI="a-aac_he-en-mp4a.40.5_96000/master.m3u8"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="a-5",NAME="Deutsch",CHANNELS="2",AUTOSELECT="YES",DEFAULT="NO",LANGUAGE="de",URI="a-aac_he-de-mp4a.40.5_96000/master.m3u8"

#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="a-6",NAME="English",CHANNELS="2",AUTOSELECT="YES",DEFAULT="NO",LANGUAGE="en",URI="a-aac_he_v2-en-mp4a.40.5_64000/master.m3u8"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="a-6",NAME="Deutsch",CHANNELS="2",AUTOSELECT="YES",DEFAULT="NO",LANGUAGE="de",URI="a-aac_he_v2-de-mp4a.40.5_64000/master.m3u8"


#EXT-X-STREAM-INF:BANDWIDTH="1976550",RESOLUTION=640x456,CODECS="avc1.42001f,ec-3",AUDIO="a-0"
v-h264-480p-avc1.42001f/master.m3u8

#EXT-X-STREAM-INF:BANDWIDTH="2011750",RESOLUTION=640x456,CODECS="avc1.42001f,mp4a.40.2",AUDIO="a-3"
v-h264-480p-avc1.42001f/master.m3u8

#EXT-X-STREAM-INF:BANDWIDTH="1870950",RESOLUTION=640x456,CODECS="avc1.42001f,mp4a.40.2",AUDIO="a-4"
v-h264-480p-avc1.42001f/master.m3u8

#EXT-X-STREAM-INF:BANDWIDTH="1835750",RESOLUTION=640x456,CODECS="avc1.42001f,mp4a.40.5",AUDIO="a-5"
v-h264-480p-avc1.42001f/master.m3u8

#EXT-X-STREAM-INF:BANDWIDTH="1800550",RESOLUTION=640x456,CODECS="avc1.42001f,mp4a.40.5",AUDIO="a-6"
v-h264-480p-avc1.42001f/master.m3u8

```

If I run the MP4box command from above against this m3u8 file I get back the following error:
```

MP4Box -mpd master.m3u8 -out master.mpd
MP4Box: media_tools/m3u8.c:752: declare_sub_playlist: Assertion `0' failed.
Aborted
```

Can somebody help? How can I convert my HLS to a Dash structure?

Thanks in advance
--- end body ---
