This business of having to guess & discover things by trial & error has been bugging me. So I've made an attempt to try to understand what's going on here & eliminate as much guesswork as I can. I know it's probably a mistake to apply logic to the situation but logic is the only tool I have. Is this stuff correct? I don't know. Maybe somebody with actual knowledge & experience in this area can look at what I've written here & correct whatever mistakes I've made. But here goes.
I have labelled the attached images CCS01, CCS02, etc. in honor of Cio-Cio-San. Also, I have attached the images instead of embedding them inline within these posts so you can click them & view them full size.
I visit the Met home page (image CCS01), hit F12 to open the Firefox Developer Tools window, & set it to the Network Monitor. As I've mentioned before, you need the Monitor open before you visit the nightly stream page because some things come up right away as soon as you open the nightly stream page & we want to see those. If you wait until after you go to the nightly stream page to hit F12, it will be too late. I continue to use the direct link off the home page, as opposed to the stream available in the Met On Demand area, for a few reasons. First, I like having the audio separate from the video for these operas. It allows for the possibility of perhaps loading one of these operas up on my iPod. I think there's a way of doing that with iTunes. That's the desktop application, not the store. I would do this so I could listen to an opera while I'm working out at the gym. You do remember gyms, right? May they reopen some day. Also, I can play the audio without watching the video if that urge takes me. Second, I like having the captions in their own .vtt file. This lets me edit them since the .vtt file is just a plain text file so you can edit them in any text editor, like Notepad. I have found a very few spelling errors in the captions. I have also found several unreadable characters in the captions for some of these operas. They display in VLC as little diamonds with a question mark inside. Mostly, these are dashes at the start of a line of dialog. Sometimes they're ellipses. A few times they've been simply incorrect punctuation that I ended up replacing with a colon or comma or even a period. So I'm still using the simple streaming page.
I click the "Watch Now" button on the home page. That takes me to the nightly stream page (image CCS02). After a moment, 3 manifest files appear in the Monitor. How do I know they're manifest files? I hover the mouse over the entry & a tool tip hovers up showing the URL of the file. The image shows only the tool tip for the first one but the other 2 are also manifests. Buried in the middle of this particularly ugly URL you'll find the notation .m3u8. (You can also see .m3u8 without hovering the mouse but I'm trying to be complete here.) This obeys the standard naming convention for manifest files. This appears to be the only accepted convention governing manifest files. I Googled manifest files a couple of weeks ago & discovered there is no international standard governing the content of manifest files. This makes what Michel has done to make VDH work as much as it does a truly remarkable effort. This is the first manifest file so I would guess that it must be an important manifest. This makes me want to look inside it to see what I can figure out.
To look inside that manifest, I double click that entry in the Monitor. This opens a new blank browser tab & pops up a dialog box (image CCS03). I have gone through this step before so some things are already in place. But the important one is that I have not checked the box to "Do this automatically." This dialog is Firefox's way of asking me every time what it should do with the file. If you have not done this before, you need to drop down the selection box to choose an application to handle this manifest file (image CCS04). When you click "Other..." in the selection box, it launches another dialog (image CCS05). You should see a few applications listed here, not necessarily the same ones I'm getting on my system. I happen to be using a replacement for Notepad called Metapad. But Notepad works just fine. What we want here is a text editor because a manifest file is just a plain text file & all we're trying to do here is look inside it. Once you've selected your text editor, this action will be preselected on every manifest file you try to look at from now on. You will be able to simply hit Enter when you get the dialog box in image CCS04. That is what I did. It launched Metapad & from there, I saved the manifest file so I could post it here (text file CCS06).
Now, I'm going to be extracting pieces of the manifest file to describe what I believe each piece means. To see where I'm getting things from, you should have text file CCS06 open in the text editor on your system so you can read along with me. Also, the URLs are extremely ugly & unwieldy. To simplify things, I will replace the actual URLs with symbolic names URL01, URL02, etc. The detail of the URL is not important. Besides, as I've said before, a portion of these URLs contains a token made up of random gibberish that associates things with my playback session. If you tried to use the URLs in text file CCS06, they wouldn't work. The idea is to realize there is a URL in a particular place in the manifest file & understand what it points to.
Each entry of the manifest file appears to begin with the string #EXT-X-. I'm going to be putting forward my best guesses of what each entry means & how it relates to the other entries. If I'm wrong, do please correct me.
Entry #1 of the manifest file is this:
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio-0",NAME="en (Main)",DEFAULT=YES,AUTOSELECT=YES,LANGUAGE="en",URI="URL01"
I think there's some significant items here. TYPE=AUDIO probably means this is a descriptor for one of the audio streams. GROUP-ID="audio-0" gives this entry a name that other entries can refer back to. URL01 contains .m3u8. In fact the URL in every entry in this manifest file contains .m3u8. That means this manifest is a sort of master manifest, pointing to other manifests. You can copy/paste each URL out of this manifest into your browser to see what those other manifests look like. I won't be cluttering up this discussion with all of that, but it would be an educational exercise for you. Of course, you'd have to visit the nightly stream page yourself to get a manifest that has URLs that would actually work for you. So this first entry in this master manifest points to what looks to be one of the audio streams. Which one? I have my guesses which I will outline as I go along. I will say that URL01 points to a manifest that consistes of a list of .ts URLs, so whatever it is, that lower level manifest appears to describe one of the streams, probably an MP4.
Entry #2 in manifest CCS06 is this:
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subtitles-0",NAME="EN",DEFAULT=YES,AUTOSELECT=YES,LANGUAGE="en",URI="URL02"
Note the TYPE=SUBTITLES here. Doesn't take much thinking to jump to the conclusion that this must be telling us where the subtitles are. (Or captions, to use the VLC terminology.) We've got GROUP-ID="subtitles-0" to give this entry a name. Visiting URL02 in the browser did, in fact, show me the manifest listing all the .vtt chunks. So it's not necessary to launch playback of the opera to find the subtitles. That is very good to know.
Entry #3 in manifest CCS06 is this:
#EXT-X-STREAM-INF:PROGRAM-ID=0,BANDWIDTH=1038400,CODECS="mp4a.40.2,avc1.42001e",RESOLUTION=640x360,AUDIO="audio-0",CLOSED-CAPTIONS=NONE,SUBTITLES="subtitles-0"
URL03
I'm a little perplexed by the fact that URL03 here is not specified as URI="URL03" similar to the other entries. But there it is. Nonetheless, it's pretty clear from several things in this entry that this must be the descriptor for the video stream at resolution 640x360. Note the AUDIO="audio-0" specification. I believe this is referring back to Entry #1 in this manifest, where it says GROUP-ID="audio-0". I believe this is telling us that Entry #1 points to the audio stream that synchs up with the video stream described in Entry #3. URL03 does point to another manifest that lists .ts chunks, which I would guess again is an MP4. Note also the SUBTITLES="subtitles-0" reference back to the GROUP-ID="subtitles-0" part of Entry #2, the entry for the subtitles. The specification BANDWIDTH=1038400 is interesting. That number is not quite 1M. Keep that number in mind for a bit. I'll come back to it.
Entry #4 in manifest CCS06 is this:
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio-1",NAME="en (Main)",DEFAULT=YES,AUTOSELECT=YES,LANGUAGE="en",URI="URL04"
This looks a lot like Entry #1 except the GROUP-ID is "audio-1" instead of "audio-0". So my best guess is this is a different audio stream. Once again, URL04 points to a manifest containing .ts entries, so that is probably another MP4.
Entry #5 in manifest CCS06 is this:
#EXT-X-STREAM-INF:PROGRAM-ID=0,BANDWIDTH=343200,CODECS="mp4a.40.2,avc1.42000d",RESOLUTION=320x180,AUDIO="audio-1",CLOSED-CAPTIONS=NONE,SUBTITLES="subtitles-0"
URL05
This must be the descriptor for the resolution 320x180 video stream. AUDIO="audio-1" in this entry refers back to GROUP-ID="audio-1" in Entry #4, connecting this video stream to that audio stream. We've got the reference back to the subtitles. BANDWIDTH=343200 works out to about 335K. URL05 points to a manifest with .ts entries. All the rest of the URLs in this manifest also point to manifests of .ts chunks.
Entry #6 in manifest CCS06 is this:
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio-2",NAME="en (Main)",DEFAULT=YES,AUTOSELECT=YES,LANGUAGE="en",URI="URL06"
So here's a third audio stream named "audio-2".
Entry #7 in manifest CCS06 is this:
#EXT-X-STREAM-INF:PROGRAM-ID=0,BANDWIDTH=635800,CODECS="mp4a.40.2,avc1.420015",RESOLUTION=480x270,AUDIO="audio-2",CLOSED-CAPTIONS=NONE,SUBTITLES="subtitles-0"
URL07
Must be the resolution 480x270 video stream using the "audio-2" audio stream in Entry #6. BANDWIDTH=635800 is about 621K. Unsurprisingly, this shares "subtitles-0" with all the other streams. Duh. There are only English subtitles available on this nightly stream page.
Entry #8 in manifest CCS06 is this:
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio-3",NAME="en (Main)",DEFAULT=YES,AUTOSELECT=YES,LANGUAGE="en",URI="URL08"
A fourth audio stream named "audio-3".
Entry #9 in manifest CCS06 is this:
#EXT-X-STREAM-INF:PROGRAM-ID=0,BANDWIDTH=1879900,CODECS="mp4a.40.2,avc1.4d001e",RESOLUTION=768x432,AUDIO="audio-3",CLOSED-CAPTIONS=NONE,SUBTITLES="subtitles-0"
URL9
The resolution 768x432 video stream using the "audio-3" audio stream in Entry #8. Shares the same subtitles as all the others. BANDWIDTH=1879900 is about 1.80M.
Entry #10 in manifest CCS06 is this:
#EXT-X-STREAM-INF:PROGRAM-ID=0,BANDWIDTH=3441900,CODECS="mp4a.40.2,avc1.4d001f",RESOLUTION=1280x720,AUDIO="audio-3",CLOSED-CAPTIONS=NONE,SUBTITLES="subtitles-0"
URL10
The resolution 1280x720 stream sharing the "audio-3" audio stream with the video stream in Entry #9. Same subtitles. BANDWIDTH=3441900 is about 3.28M.
This is the last entry in the master manifest.
We've got 4 audio streams & 5 video streams. Look at what VDH recognizes (image CCS07). VDH appears to have recognized all 5 of the video streams. Compare the Mbps ratings in the VDH menu against the numbers provided by the BANDWIDTH values in the entries in the master manifest. I came up with my numbers by dividing by 1,024, which is of course 1K. Or dividing by 1Kx1K for the larger BANDWIDTH values. It looks like VDH may not be dividing the numbers correctly, dividing by either 1,000 or 1,000,000, and then rounding pretty liberally. I'm a computer geek. I expect these things to be relative to powers of 2. I guess that's just not the way things are done with streaming media. It may be that VDH is getting these numbers from a source other than the manifest. I just don't know. Also, the highest resolution variant is being displayed in the VDH menu with a duration that is double the truth. Plus 1 second. Now that's weird. You'll note that certain entries in the manifest have a NAME= parameter & that value appears in some of the VDH variant names. I'm talking about the "EN (MAIN)" indications that appear on the VDH menu. You can see in the manifest where those are coming from. Interesting that the manifest shows "en" in lower case but VDH has changed it to upper case.
But there's only 1 audio stream listed. Which one? Why not all 4? Plus it shows the erroneous double duration. Well, I haven't launched playback yet. Once I do that, VDH recognizes more things (image CCS08). The list is now long enough that I have to scroll it. The 5 video streams are still there, unchanged, in the part of the VDH menu that is scrolled out of sight. But now there's 5 audio streams, not 4. But one of them is the double duration stream that was already listed. The new entries appear to be the correct audio streams. But which is which? Which audio stream goes with which video stream? Would downloading the double length streams stop after the correct duration of 2:26:50?
(As an aside, I am reminded once again that the VDH menu chops off the controls at the bottom when it gets long enough to scroll. I have been trying to shame Michel into fixing this bug for 2 years. When will we get this fixed? How much complaining is it going to take?)
So, following this analysis, I'm going to beef up my 1-line script that I described upthread here. I'm going to boost it to 3 lines, each invoking ffmpeg. The 3 lines will get, respectively, the captions, the audio, & the video. It looks something like this:
ffmpeg -i URL02 Opera.vtt
ffmpeg -i URL08 Audio.mp4
ffmpeg -i URL10 Video.mp4
That shows the essential parts. I do the files in this order because the captions take less than a minute, the audio anywhere from 15 to 25 minutes, & the video at least 2 hours if not 3. On my slow connection, remember. I have chosen the URLs for the manifests that describe the highest resolution video stream & its associated audio stream. I don't have to guess via the VDH menu. The manifest tells me exactly which audio stream goes with that video stream. My actual script is a little more elaborate, allowing me to capture some logging information. Here is the full script as I am executing it:
"C:\Program Files\net.downloadhelper.coapp\converter\build\win\64\ffmpeg.exe" -i
https://manifest.prod.boltdns.net/manifest/v1/hls/v4/clear/102076671001/f0688e1b-7452-4124-9d7d-c03cf41117a5/a561c6fb-6016-4438-9075-17efaa836f3f/rendition.m3u8?fastly_token=NWU5YjgyMWZfNmYyYjQ2ZjFhOGM3ODMxOWYyZjM0MDJlMWIwNmRkZDlmOTY2MDA0NmIwMTQzZDA4N2QzMzJmNThkN2UzZDBkOQ%3D%3D "Q:\Opera\Madama Butterfly Video 20090307.vtt" 1>"Q:\Opera\Get Opera.Err" 2>"Q:\Opera\Get Opera.Log"
"C:\Program Files\net.downloadhelper.coapp\converter\build\win\64\ffmpeg.exe" -i
https://manifest.prod.boltdns.net/manifest/v1/hls/v4/clear/102076671001/f0688e1b-7452-4124-9d7d-c03cf41117a5/a8d6efa6-91bb-4d6f-acaa-b90fe619371c/10s/rendition.m3u8?fastly_token=NWU5YjgyMWZfMTFjYTJkZDkyNzQzMDQ2MzJlMWY5YmY3YzI0MGQxNDMyN2RkM2U5ZDA1NGQ5YjUyMzFjYWUxYTMzMjlhNjM1MQ%3D%3D "Q:\Opera\Madama Butterfly Audio 20090307.mp4" 1>>"Q:\Opera\Get Opera.Err" 2>>"Q:\Opera\Get Opera.Log"
"C:\Program Files\net.downloadhelper.coapp\converter\build\win\64\ffmpeg.exe" -i
https://manifest.prod.boltdns.net/manifest/v1/hls/v4/clear/102076671001/f0688e1b-7452-4124-9d7d-c03cf41117a5/77682e8a-b7d1-49c9-88af-e2acfbd663d4/10s/rendition.m3u8?fastly_token=NWU5YjgyMWZfZGFlYTY3NTUwNjNlODZjMDQ1YmRlYzllZTQ4Njc3YWQxNGNhNzEwYzllNmE4NTUyZjIxNGE0NTVhODZmNjg3Mw%3D%3D "Q:\Opera\Madama Butterfly Video 20090307.mp4" 1>>"Q:\Opera\Get Opera.Err" 2>>"Q:\Opera\Get Opera.Log"
exit
Now, this isn't perfect. It worked well enough to download the captions & the audio stream. But for some reason the third command to download the video failed on me after running apparently correctly for about 10 minutes. After that, it simply stopped reading the stream even though ffmpeg showed as active in the Task Manager. It happened twice in rapid succession so I reverted to using VDH to download that part of the opera. There may be some odd parameter I'm not specifying. I also noted that the download was using only about half my bandwidth. I feel like I'm really close. I may investigate wget if I feel really motivated. For now, at least I know how to figure out how to match the right audio stream with the highest resolution video stream.
I also would like to know what is the significance of an entry that starts with #EXT-X-MEDIA: as opposed to #EXT-X-STREAM-INF:. Given the lack of standards, I can't say whether this sort of thing occurs on other web sites. For all I know, it's all unique to the Brightcove player.
Or somebody will read this & tell me something that will get me over this obstacle.