26

When I open this page I can see in Firefox Web Developer Tools / "Network" tab that the page loads files with .mpd extension. And then every few seconds it loads a file/stream with .m4s extension named like

000000.m4s
000001.m4s

How can I download the whole streamed video of this kind?

I think I need to download all .m4s segments but do not know the Linux command or the Windows software to do it. Then I will need to merge these files to a single .mp4

I already tried InviDownloader, but it has numerous problems.

2
  • 3
    I tried your sample site with youtube-dl and I was able to download it. The software automatically merges them into one file
    – nixda
    Apr 29, 2017 at 11:14
  • @nixda thx, youtube-dl worked! Thank you. Here is how to setup it on the Windows.
    – 16851556
    Apr 29, 2017 at 21:19

2 Answers 2

20

Answering the question "How can I download the whole streamed video of this kind?"

You can use youtube-dl on the DASH mpd manifest URL to download the video, it worked for me.

youtube-dl {mpd_url}

Maybe you should make clear in the title if you really want these intermediate m2s files or you just want the whole video file.

5
  • What question are you answering?
    – Toto
    Feb 23, 2018 at 10:44
  • Nice! Did not know that youtube-dl can deal with DASH streams.
    – chrisma
    Aug 1, 2018 at 11:52
  • That's good news, but what do when I get this error: WARNING: Could not send HEAD request to https://ivys-vst09-6.o2tv.cz/atip/d2560c21d68b9e22bec2bbd624c618cd/1599203098571/61924494877602384-pc.mpd?userId=b090f86c-e193-4ad9-a8ac-ec77d37f334f: <urlopen error [Errno 11001] getaddrinfo failed> It seems that the host ivys-vst09-6.o2tv.cz cannot be normally resolved. But I see it perfectly resolved when I inspect the chunked transfers in the Network-Monitor of the browser.
    – Zababa
    Sep 4, 2020 at 8:47
  • @Zababa I don't have a getaddrinfo error on my side, just a rather standard "HTTP Error 403: Forbidden". Can you curl this URL in your terminal? If you see the 403 error, I'd say to use some cookie options that you import from your browser to solve this.
    – FredG
    Sep 4, 2020 at 12:46
  • This still works, as of today - I was using youtube-dl version, 2017.11.26
    – Brad Parks
    Jun 16, 2021 at 18:46
8

1) download IS.mp4 and all *.m4s for video (use wget) and merge IS.mp4 and *.m4s to one file video.mp4

2) download IS.mp4 and all *.m4s for audio and merge IS.mp4 and *.m4s to one file audio.mp4

3) merge video and audio into one file (use ffmpeg -i video.mp4 -i audio.mp4 -c copy movie.mkv)

EDIT

Example how to download audio stream:

echo "IS.mp4" >"links.txt"
seq -f "%06g.m4s" 0 394 >>"links.txt"
wget -i "links.txt" -O "audio.mp4" -B "http://80.188.78.212/aa/ffc8a55fe6f203b0bffecb73efacb69b/1494953435522/eda9c6f7b1e3de68db8e3e5dc0d14fc7/dna-61924494877285694-pc/1002-1502/"

Initial part for audio stream is IS.mp4, audio consists of 394 parts (in a format of 6 digits) and base URL path for audio stream is http://80.188..../1002-1502/. All these information can be obtained from .mpd file.

NOTE: base URL of audio and video stream is changed eachtime you play the video

5
  • >>> download IS.mp4 and all *.m4s for audio and merge IS.mp4 and *.m4s to one file audio.mp4 >>> HOW?
    – tent
    May 15, 2017 at 20:14
  • see example above May 16, 2017 at 17:28
  • @Unsociableape What if m4s files have a hash instead of a number increasing in ᴜʀʟ ? In that case, it seems a specific tool is required… Nov 21, 2017 at 0:55
  • @user2284570 vimeo have segments in json file, there is audio base url, base64 of audio init segment, audio segment list with start time, end time and url. The same also for video.
    – andrej
    Mar 22, 2018 at 10:36
  • @Unsociableape , thank you, works perfectly !
    – trogne
    Mar 31, 2019 at 16:05

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