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 <AdaptationSet/> elements with attribute mimeType in manifest.mpd.

They both contain a <SegmentTemplate/> 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 :

<AdaptationSet mimeType="video/mp4" ...other attributes>
      <S t="0" d="900000"/>
      <S d="900000" r="352"/>
      <S d="638370"/>
  <Representation id="SOME-ID" codecs="avc1.640029" sar="1:1" bandwidth="1268094"/>
<AdaptationSet mimeType="audio/mp4" ...other attributes>

will produce requests to


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
  • 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 Jul 9 '18 at 13:24
  • Tried with ffmpeg 3.4.1, but got manifest.mpd: Invalid data found when processing input – kit Jul 9 '18 at 13:38
  • 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 Jul 9 '18 at 13:42
  • Try with the latest version. There have been a number of bugs fixed over the last few months. – Gyan Jul 9 '18 at 14:15
  • Updated to ffmpeg 4.0.1, still the same error – kit Jul 9 '18 at 14:47

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 bold below):


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.