27

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.

karel
  • 13,390
  • 26
  • 45
  • 52
16851556
  • 493
  • 2
  • 5
  • 17
  • 3
    I tried your sample site with [youtube-dl](https://rg3.github.io/youtube-dl/) and I was able to download it. The software automatically merges them into one file – nixda Apr 29 '17 at 11:14
  • @nixda thx, youtube-dl worked! Thank you. [Here](https://internetlifeforum.com/computers-technology/7701-how-use-youtube-dl-exe-windows/) is how to setup it on the Windows. – 16851556 Apr 29 '17 at 21:19

2 Answers2

22

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.

FredG
  • 341
  • 2
  • 5
  • What question are you answering? – Toto Feb 23 '18 at 10:44
  • Nice! Did not know that [youtube-dl](https://rg3.github.io/youtube-dl/) can deal with DASH streams. – chrisma Aug 01 '18 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: ` 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. – fleetingbytes Sep 04 '20 at 08: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 04 '20 at 12:46
  • This still works, as of today - I was using youtube-dl version, `2017.11.26` – Brad Parks Jun 16 '21 at 18:46
9

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