<p>Regarding your FFMPEG issue, you need to build/obtain <em>FFmpeg</em> with <code>--enable-libxml2</code> configuration enabled to correctly parse a <code>manifest.mpd</code> file.</p>

<p>You can check whether your <em>FFmpeg</em> supports <code>libxml2</code> by simply running it without any arguments. Here is the output from <em>FFmpeg</em> 4.1 I built with -<code>-enable-libxml2</code> (see <code>--enable-libxml2</code> in the start of the 4<sup>th</sup> line of the output):</p>

<pre><code>%./ffmpeg

ffmpeg version n4.1-10-g59e30c05d7 Copyright (c) 2000-2018 the FFmpeg developers   
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.6) 20160609
 configuration: --enable-gpl --enable-version3 --enable-openssl 
--enable-libxml2 --enable-libssh --enable-libvorbis --enable-libvpx 
--enable-libwavpack --enable-libwebp --enable-libx264 
--enable-libx265 --enable-libxvid --enable-libzmq 
--enable-libzvbi --enable-libopus --enable-libpulse --enable-gmp --enable-libmodplug --enable-nonfree
          libavutil      56. 22.100 / 56. 22.100
          libavcodec     58. 35.100 / 58. 35.100
          libavformat    58. 20.100 / 58. 20.100
          libavdevice    58.  5.100 / 58.  5.100
          libavfilter     7. 40.101 /  7. 40.101
          libswscale      5.  3.100 /  5.  3.100
          libswresample   3.  3.100 /  3.  3.100
          libpostproc    55.  3.100 / 55.  3.100
        Hyper fast Audio and Video encoder
</code></pre>

<p>Regarding your question above, once you have a working <em>FFmpeg</em> with <code>--enable-libxml2</code>, you can transcode the <code>.mpd</code> to <code>.mp4</code>:</p>

<pre><code>ffmpeg -i manifest.mpd -codec copy out.mp4
</code></pre>

<p>Note: I use <code>-codec copy</code> above to avoid transcoding of actual video and audio.</p>

CC BY-SA 4.0
2021-05-29T22:11:39.980Z
I can see I have `--enable-libxml2` but there are still errors when I try on a downloaded mpd file:                                             
```[dash @ 0x564eaaa95740] Filename extension of 'dash/e10f30c1-485c-4f2f-8d62-403cde8d4c10_monde_TA-video=400000.dash' is not a common multimedia extension, blocked for security reasons.      
If you wish to override this adjust allowed_extensions, you can set it to 'ALL' to allow all```
But `-allowed_extensions ALL` produces errors also.
With youtube-dl it worked on the mpd URL (ffmpeg got 403 Forbidden).
baptx
CC BY-SA 4.0
2018-12-05T08:04:18.000Z
2019-06-12T11:58:15.023Z
2019-06-12T11:58:15.023Z
YoavG
<p>Easy <a href="https://ytdl-org.github.io/youtube-dl/index.html" rel="noreferrer">youtube-dl</a> example on macOS (in the command line Terminal; Windows supported too):</p>

<pre><code>$ youtube-dl -F https://bitdash-a.akamaihd.net/content/MI201109210084_1/m3u8s/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.m3u8
[generic] f08e80da-bf1d-4e3d-8899-f0f6155f6efa: Requesting header
[generic] f08e80da-bf1d-4e3d-8899-f0f6155f6efa: Downloading m3u8 information
[info] Available formats for f08e80da-bf1d-4e3d-8899-f0f6155f6efa:
format code           extension  resolution note
audio-English_stereo  mp4        audio only [en] 
628                   mp4        320x180     628k , avc1.42c00d, video only
928                   mp4        480x270     928k , avc1.42c00d, video only
1728                  mp4        640x360    1728k , avc1.42c00d, video only
2528                  mp4        960x540    2528k , avc1.42c00d, video only
4928                  mp4        1280x720   4928k , avc1.42c00d, video only
9728                  mp4        1920x1080  9728k , avc1.42c00d, video only (best)

$ youtube-dl --format 628 https://bitdash-a.akamaihd.net/content/MI201109210084_1/m3u8s/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.m3u8
...
frame= 5257 fps=193 q=-1.0 Lsize=    6746kB time=00:03:30.16 bitrate= 263.0kbits/s speed=7.73x    
video:6679kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.998669%
[ffmpeg] Downloaded 6907810 bytes
[download] 100% of 6.59MiB in 00:29

$ open f08e80da-bf1d-4e3d-8899-f0f6155f6efa-f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mp4
</code></pre>

<p>Use the browser's Developer Tools > Network to get the mpd/m3u8 (DASH/HLS manifest) URL when starting a streaming video.</p>

CC BY-SA 4.0
2019-06-26T22:43:36.853Z
works like a charm
deepelement
CC BY-SA 4.0
2019-06-11T00:40:44.573Z
2019-06-11T00:40:44.573Z
Peter Tseng
<p>In addition to ffmpeg and youtube-dl/yt-dlp mentioned upthread, you can try</p>
<ul>
<li><p><code>streamlink -o /tmp/output.mp4 &lt;MPD-URL&gt; best</code> (from <a href="https://streamlink.github.io/" rel="nofollow noreferrer">https://streamlink.github.io/</a>)</p>
</li>
<li><p><code>vlc &lt;MPD-URL&gt;</code> (from <a href="https://www.videolan.org/vlc/" rel="nofollow noreferrer">https://www.videolan.org/vlc/</a>)</p>
</li>
<li><p><code>gst-launch-1.0 playbin uri=&lt;MPD-URL&gt;</code> (from gstreamer)</p>
</li>
<li><p><code>dash-mpd-cli &lt;MPD-URL&gt;</code> (from <a href="https://github.com/emarsden/dash-mpd-cli" rel="nofollow noreferrer">https://github.com/emarsden/dash-mpd-cli</a>)</p>
</li>
</ul>
<p>Only dash-mpd-cli will work with DRM-encrypted content (assuming you have the necessary decryption keys).</p>

CC BY-SA 4.0
2022-10-24T21:06:25.953Z
2023-11-19T13:40:16.407Z
2023-11-19T13:40:16.407Z
Eric Marsden
<p>ffmpeg -i manifest.mpd -codec copy out.mp4 almost works.</p>

<p>the file that is downloaded is corrupt. Only distorted colors are seen in the downloaded video.</p>

<p><div class="youtube-embed"><div>
                <iframe width="640px" height="395px" src="https://www.youtube.com/embed/Th9enBZSLLg?start=0"></iframe>
            </div></div></p>

CC BY-SA 4.0
2019-09-18T12:09:58.777Z
2019-09-18T12:25:30.210Z
2019-09-18T12:25:30.210Z
daniAG
<p>For me the BaseURL wasn't a url it was the file names, so when you ran this</p>
<p><code>ffmpeg -i DASHPlaylist.mpd -c copy out.mp4</code></p>
<p>It doesn't know where to get the data from.</p>
<p><a href="https://i.sstatic.net/NnheJ.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/NnheJ.png" alt="enter image description here" /></a></p>
<p>So what we can do is add the url of the <code>.mpd</code> file to each <strong>BaseURL</strong> or use the source of of the <code>.mpd</code> file to run <strong>ffmpeg</strong>. (edit each .mpd file you download to add the urls to each BaseURL or use the <strong>.mpd</strong> file from the URL)</p>
<p><a href="https://i.sstatic.net/crAuE.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/crAuE.png" alt="enter image description here" /></a></p>
<p>Or</p>
<p><code>ffmpeg -i https://example.com/unique_id/DASHPlaylist.mpd -c copy out.mp4</code></p>
<p>Which should have the same out.mp4 file.</p>

CC BY-SA 4.0
2024-04-03T04:35:09.607Z
2024-04-03T04:35:09.607Z
Alohe
<p>I can watch videos on a website with MPEG-DASH technology.</p>

<p>I can obtain the video's <code>manifest.mpd</code> file from the website. (I am not sure whether the file contains any user credentials or not, so I am not going to post it)</p>

<p>The video contains 3 tracks (1 video track + 2 audio tracks), and I found 3 <code>&lt;AdaptationSet/&gt;</code> elements with attribute <code>mimeType</code> in <code>manifest.mpd</code>.</p>

<p>They both contain a <code>&lt;SegmentTemplate/&gt;</code> element which has an attribute <code>media</code> containing the segment filename template which is being used to download the segment files in the browser from time to time.</p>

<p>The values to be used to construct the segment file URL are inside <code>SegmentTemplate.SegmentTimeline.S</code> elements.</p>

<p>For example :</p>

<pre><code>...
&lt;AdaptationSet mimeType="video/mp4" ...other attributes&gt;
  &lt;SegmentTemplate
    presentationTimeOffset="0"
    timescale="90000"
    media="chunk_video_$RepresentationID$_cs$Time$_mpd.m4s"
    initialization="chunk_video_$RepresentationID$_cinit_mpd.m4s"
  &gt;
    &lt;SegmentTimeline&gt;
      &lt;S t="0" d="900000"/&gt;
      &lt;S d="900000" r="352"/&gt;
      &lt;S d="638370"/&gt;
    &lt;/SegmentTimeline&gt;
  &lt;/SegmentTemplate&gt;
  &lt;Representation id="SOME-ID" codecs="avc1.640029" sar="1:1" bandwidth="1268094"/&gt;
&lt;AdaptationSet/&gt;
&lt;AdaptationSet mimeType="audio/mp4" ...other attributes&gt;
...
</code></pre>

<p>will produce requests to</p>

<pre><code>https://some-website-domain/some-path/chunk_video_SOME-ID_cinit_mpd.m4s
https://some-website-domain/some-path/chunk_video_SOME-ID_cs0_mpd.m4s
https://some-website-domain/some-path/chunk_video_SOME-ID_cs900000_mpd.m4s
https://some-website-domain/some-path/chunk_video_SOME-ID_cs1800000_mpd.m4s
https://some-website-domain/some-path/chunk_video_SOME-ID_cs2700000_mpd.m4s
...
</code></pre>

<p><code>some-website-domain/some-path</code> is not sure at this moment, but I could figure this out.</p>

<p>The real question is:</p>

<p>Is it possible to download and encode all the segment files into one single video file?</p>

<p>---- EDIT ----</p>

<p>After running the following command:</p>

<pre><code>ffmpeg -v 48 -i manifest.mpd -c copy out.mp4
</code></pre>

<p>I got this output:</p>

<pre><code>Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with argument '48'.
Reading option '-i' ... matched as input url with argument 'manifest.mpd'.
Reading option '-c' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option 'out.mp4' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument 48.
Successfully parsed a group of options.
Parsing a group of options: input url manifest.mpd.
Successfully parsed a group of options.
Opening an input file: manifest.mpd.
[NULL @ 0x7feff2000800] Opening 'manifest.mpd' for reading
[file @ 0x7feff1c0b100] Setting default whitelist 'file,crypto'
[AVIOContext @ 0x7feff1c0b2c0] Statistics: 28989 bytes read, 0 seeks
manifest.mpd: Invalid data found when processing input
</code></pre>

CC BY-SA 4.0
2018-07-09T13:24:07.410Z
Should be as simple as `ffmpeg -i in.mpd -c copy out.mp4`. The dash demuxer will fetch the segments and demux in order.
Gyan
CC BY-SA 4.0
2018-07-09T13:38:57.807Z
Tried with ffmpeg 3.4.1, but got `manifest.mpd: Invalid data found when processing input`
kit
CC BY-SA 4.0
2018-07-09T13:42:37.543Z
I guess some data in the MPD is not in standard format, so ffmpeg could not construct the segment filename, for example, ffmpeg may not know `id` of `<Representation/>` is related to `media` of `<SegmentTemplate/>`.
kit
CC BY-SA 4.0
2018-07-09T14:15:12.853Z
Try with the latest version. There have been a number of bugs fixed over the last few months.
Gyan
CC BY-SA 4.0
2018-07-09T14:47:26.340Z
Updated to ffmpeg 4.0.1, still the same error
kit
CC BY-SA 4.0
2018-07-09T15:02:06.113Z
How to find the "invalid data"?
kit
CC BY-SA 4.0
2018-07-09T15:46:52.940Z
`invalid data` indicates that ffmpeg can't parse the mpd. Share full log.
Gyan
CC BY-SA 4.0
2018-07-09T16:01:43.963Z
This complete output is just the ffmpeg built information and this error message. How can I know which part of the file is invalid?
kit
CC BY-SA 4.0
2018-07-09T16:40:43.210Z
If there's no informative msg, then you need to switch to higher loglevel `-v 48`.
Gyan
CC BY-SA 4.0
2018-07-09T16:44:20.410Z
Please see the edited question
kit
CC BY-SA 4.0
2018-07-09T17:12:03.493Z
You can open a ticket at trac.ffmpeg.org. Be prepared to share the mpd file.
Gyan
CC BY-SA 4.0
2018-07-09T19:17:27.723Z
I think the videos are encrypted and I found something about the license files of Widevine and PlayReady in the source of the website. I think I could obtain the license file. Can ffmpeg deal with DRM?
kit
CC BY-SA 4.0
2022-10-14T11:19:37.733Z
I was able to download an MPD stream on Debian 11 Bullseye (ffmpeg 4.3.4) but not on Debian 10 Buster (ffmpeg 4.1.9).
baptx
<ffmpeg><mpeg-dash>
How to download and encode a video from a MPD manifest?
kit
# How to download and encode a video from a MPD manifest?

(Asked by: username_0 on 2018-07-09)

I can watch videos on a website with MPEG-DASH technology.
I can obtain the video's manifest.mpd file from the website. (I am not sure whether the file contains any user credentials or not, so I am not going to post it)
The video contains 3 tracks (1 video track + 2 audio tracks), and I found 3  elements with attribute mimeType in manifest.mpd.
They both contain a  element which has an attribute media containing the segment filename template which is being used to download the segment files in the browser from time to time.
The values to be used to construct the segment file URL are inside SegmentTemplate.SegmentTimeline.S elements.
For example :
...

  
    
      
      
      
    
  
  


...

will produce requests to
https://some-website-domain/some-path/chunk_video_SOME-ID_cinit_mpd.m4s
https://some-website-domain/some-path/chunk_video_SOME-ID_cs0_mpd.m4s
https://some-website-domain/some-path/chunk_video_SOME-ID_cs900000_mpd.m4s
https://some-website-domain/some-path/chunk_video_SOME-ID_cs1800000_mpd.m4s
https://some-website-domain/some-path/chunk_video_SOME-ID_cs2700000_mpd.m4s
...

some-website-domain/some-path is not sure at this moment, but I could figure this out.
The real question is:
Is it possible to download and encode all the segment files into one single video file?
---- EDIT ----
After running the following command:
ffmpeg -v 48 -i manifest.mpd -c copy out.mp4

I got this output:
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with argument '48'.
Reading option '-i' ... matched as input url with argument 'manifest.mpd'.
Reading option '-c' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option 'out.mp4' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument 48.
Successfully parsed a group of options.
Parsing a group of options: input url manifest.mpd.
Successfully parsed a group of options.
Opening an input file: manifest.mpd.
[NULL @ 0x7feff2000800] Opening 'manifest.mpd' for reading
[file @ 0x7feff1c0b100] Setting default whitelist 'file,crypto'
[AVIOContext @ 0x7feff1c0b2c0] Statistics: 28989 bytes read, 0 seeks
manifest.mpd: Invalid data found when processing input

**Tags:** ffmpeg, mpeg-dash

> **Comments:**
> **username_1**: Should be as simple as `ffmpeg -i in.mpd -c copy out.mp4`. The dash demuxer will fetch the segments and demux in order.  
> **username_0**: Tried with ffmpeg 3.4.1, but got `manifest.mpd: Invalid data found when processing input`  
> **username_0**: I guess some data in the MPD is not in standard format, so ffmpeg could not construct the segment filename, for example, ffmpeg may not know `id` of `<Representation/>` is related to `media` of `<SegmentTemplate/>`.  
> **username_1**: Try with the latest version. There have been a number of bugs fixed over the last few months.  
> **username_0**: Updated to ffmpeg 4.0.1, still the same error  
> **username_0**: How to find the "invalid data"?  
> **username_1**: `invalid data` indicates that ffmpeg can't parse the mpd. Share full log.  
> **username_0**: This complete output is just the ffmpeg built information and this error message. How can I know which part of the file is invalid?  
> **username_1**: If there's no informative msg, then you need to switch to higher loglevel `-v 48`.  
> **username_0**: Please see the edited question  
> **username_1**: You can open a ticket at trac.ffmpeg.org. Be prepared to share the mpd file.  
> **username_0**: I think the videos are encrypted and I found something about the license files of Widevine and PlayReady in the source of the website. I think I could obtain the license file. Can ffmpeg deal with DRM?  
> **username_2**: I was able to download an MPD stream on Debian 11 Bullseye (ffmpeg 4.3.4) but not on Debian 10 Buster (ffmpeg 4.1.9).  

---

## 5 answers

### Answer by username_3 on 2018-12-05. Score: 12

Regarding your FFMPEG issue, you need to build/obtain FFmpeg with --enable-libxml2 configuration enabled to correctly parse a manifest.mpd file.
You can check whether your FFmpeg supports libxml2 by simply running it without any arguments. Here is the output from FFmpeg 4.1 I built with --enable-libxml2 (see --enable-libxml2 in the start of the 4th line of the output):
%./ffmpeg

ffmpeg version n4.1-10-g59e30c05d7 Copyright (c) 2000-2018 the FFmpeg developers   
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.6) 20160609
 configuration: --enable-gpl --enable-version3 --enable-openssl 
--enable-libxml2 --enable-libssh --enable-libvorbis --enable-libvpx 
--enable-libwavpack --enable-libwebp --enable-libx264 
--enable-libx265 --enable-libxvid --enable-libzmq 
--enable-libzvbi --enable-libopus --enable-libpulse --enable-gmp --enable-libmodplug --enable-nonfree
          libavutil      56. 22.100 / 56. 22.100
          libavcodec     58. 35.100 / 58. 35.100
          libavformat    58. 20.100 / 58. 20.100
          libavdevice    58.  5.100 / 58.  5.100
          libavfilter     7. 40.101 /  7. 40.101
          libswscale      5.  3.100 /  5.  3.100
          libswresample   3.  3.100 /  3.  3.100
          libpostproc    55.  3.100 / 55.  3.100
        Hyper fast Audio and Video encoder

Regarding your question above, once you have a working FFmpeg with --enable-libxml2, you can transcode the .mpd to .mp4:
ffmpeg -i manifest.mpd -codec copy out.mp4

Note: I use -codec copy above to avoid transcoding of actual video and audio.

> **Comments:**
> **username_2**: I can see I have `--enable-libxml2` but there are still errors when I try on a downloaded mpd file:                                              ```[dash @ 0x564eaaa95740] Filename extension of 'dash/e10f30c1-485c-4f2f-8d62-403cde8d4c10_monde_TA-video=400000.dash' is not a common multimedia extension, blocked for security reasons.       If you wish to override this adjust allowed_extensions, you can set it to 'ALL' to allow all``` But `-allowed_extensions ALL` produces errors also. With youtube-dl it worked on the mpd URL (ffmpeg got 403 Forbidden).  

---

### Answer by username_4 on 2019-06-11. Score: 5

Easy youtube-dl example on macOS (in the command line Terminal; Windows supported too):
$ youtube-dl -F https://bitdash-a.akamaihd.net/content/MI201109210084_1/m3u8s/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.m3u8
[generic] f08e80da-bf1d-4e3d-8899-f0f6155f6efa: Requesting header
[generic] f08e80da-bf1d-4e3d-8899-f0f6155f6efa: Downloading m3u8 information
[info] Available formats for f08e80da-bf1d-4e3d-8899-f0f6155f6efa:
format code           extension  resolution note
audio-English_stereo  mp4        audio only [en] 
628                   mp4        320x180     628k , avc1.42c00d, video only
928                   mp4        480x270     928k , avc1.42c00d, video only
1728                  mp4        640x360    1728k , avc1.42c00d, video only
2528                  mp4        960x540    2528k , avc1.42c00d, video only
4928                  mp4        1280x720   4928k , avc1.42c00d, video only
9728                  mp4        1920x1080  9728k , avc1.42c00d, video only (best)

$ youtube-dl --format 628 https://bitdash-a.akamaihd.net/content/MI201109210084_1/m3u8s/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.m3u8
...
frame= 5257 fps=193 q=-1.0 Lsize=    6746kB time=00:03:30.16 bitrate= 263.0kbits/s speed=7.73x    
video:6679kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.998669%
[ffmpeg] Downloaded 6907810 bytes
[download] 100% of 6.59MiB in 00:29

$ open f08e80da-bf1d-4e3d-8899-f0f6155f6efa-f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mp4

Use the browser's Developer Tools > Network to get the mpd/m3u8 (DASH/HLS manifest) URL when starting a streaming video.

> **Comments:**
> **username_5**: works like a charm  

---

### Answer by username_6 on 2022-10-24. Score: 2

In addition to ffmpeg and youtube-dl/yt-dlp mentioned upthread, you can try

* `streamlink -o /tmp/output.mp4  best` (from <https://streamlink.github.io/>)
* `vlc`  (from <https://www.videolan.org/vlc/>)
* `gst-launch-1.0 playbin uri=` (from gstreamer)
* `dash-mpd-cli`  (from <https://github.com/emarsden/dash-mpd-cli>)

Only dash-mpd-cli will work with DRM-encrypted content (assuming you have the necessary decryption keys).


---

### Answer by username_7 on 2019-09-18. Score: 1

ffmpeg -i manifest.mpd -codec copy out.mp4 almost works.

the file that is downloaded is corrupt. Only distorted colors are seen in the downloaded video.


---

### Answer by username_8 on 2024-04-03. Score: 0

For me the BaseURL wasn't a url it was the file names, so when you ran this

`ffmpeg -i DASHPlaylist.mpd -c copy out.mp4`

It doesn't know where to get the data from.

[![enter image description here](https://i.sstatic.net/NnheJ.png)](https://i.sstatic.net/NnheJ.png)

So what we can do is add the url of the `.mpd` file to each **BaseURL** or use the source of of the `.mpd` file to run **ffmpeg**. (edit each .mpd file you download to add the urls to each BaseURL or use the **.mpd** file from the URL)

[![enter image description here](https://i.sstatic.net/crAuE.png)](https://i.sstatic.net/crAuE.png)

Or

`ffmpeg -i https://example.com/unique_id/DASHPlaylist.mpd -c copy out.mp4`

Which should have the same out.mp4 file.


---

