K-S-V / Scripts

Collection of my scripts
GNU General Public License v3.0
634 stars 226 forks source link

Playback of merged videos stops at around 75% #47

Closed lifeless closed 8 years ago

lifeless commented 9 years ago

I'm downloading streaming videos from a tutorial site (I can provide the manifest URLs privately by e-mail). The command line is simply php AdobeHDS.php --manifest '[url]' --delete

Each and every video completes downloading and merging into a single flv file, but playback in all of them stops at around 75%. I'm playing them back on VLC 2.1.5 on a Mac.

How can I assist in debugging this?

lifeless commented 9 years ago

The same thing also happens when downloading the same stream with Livestreamer. (The site is digital-tutors.com.)

K-S-V commented 9 years ago

Can you confirm that the said video works completely on website itself? it may be problem with their video encoding rather than script itself. if it works properly on website the you can remove the --delete switch from command line. it will save the downloaded fragments in same directory. you need to upload last few fragments to somewhere so i can check where the problem actually lies.

lifeless commented 9 years ago

The video works on the website itself, yes. Further research into the matter has shown that the problem is probably due to some countermeasures deployed by akamaihd.net: if the requests for the fragments don't have the correct cookie or query parameters (and/or they come in too quickly, haven't verified this), they respond by sending invalid data for the last quarter of the video. So it seems that the issue is a missing (or undiscovered by me) feature rather than a bug in AdobeHDS.php per se.

I've since solved the problem by creating a set of custom scripts that do the downloading with cURL, though some manual labor is involved in getting the fragment URLs. I then simply combine the result locally with AdobeHDS.php, and the videos are completely intact. This issue can be closed as far as I'm concerned, though I'll leave that to you just in case you want to examine this further.

K-S-V commented 9 years ago

Having the access to actual manifest may have helped to diagnose the issue in better way. you can still try to remove the --delete option and then retry downloading the last 25% of fragments using --start switch. it may remove the dependency on your external scripts to download the fragments.