Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
AdobeHDS is a PHP script to join HDS fragments into flv file. You can either use manifest switch or use any download manager with batch capabilities to download the fragments although use of manifest switch is recommended.
php AdobeHDS.php --manifest "your_manifest_url" --delete
Offline fragment processing
If you fragments are serially numbered without a base filename (1.f4f, 2.f4f, … 99.f4f) then you can run the script without any parameter, and it will look for the fragments in current directory and output will be saved as Joined.flv.
However if your fragments are named with base filename (MyVideo-Seg1-Frag1.f4f, MyVideo-Seg1-Frag2.f4f, … MyVideo-Seg1-Frag99.f4f) then you can pass the base filename with fragments switch to the script and it will look for the fragments starting with this name, and output will be saved as MyVideo-Seg1-Frag.flv. f4f extension is optional.
1.f4f, 2.f4f, … 99.f4f
MyVideo-Seg1-Frag1.f4f, MyVideo-Seg1-Frag2.f4f, … MyVideo-Seg1-Frag99.f4f
php AdobeHDS.php --fragments MyVideo-Seg1-Frag
php AdobeHDS.php MyVideo-Seg1-Frag
You can use the script with following options:
--help displays this help --debug show debug output --delete delete fragments after processing --fproxy force proxy for downloading of fragments --play dump stream to stdout for piping to media player --rename rename fragments sequentially before processing --update update the script to current git version --adkey [param] akamai session decryption key --auth [param] authentication string for fragment requests --duration [param] stop recording after specified number of seconds --filesize [param] split output file in chunks of specified size (MB) --fragments [param] base filename for fragments --fixwindow [param] timestamp gap between frames to consider as timeshift --manifest [param] manifest file for downloading of fragments --maxspeed [param] maximum bandwidth consumption (KB) for fragment downloading --outdir [param] destination folder for output file --outfile [param] filename to use for output file --parallel [param] number of fragments to download simultaneously --proxy [param] proxy for downloading of manifest --quality [param] selected quality level (low|medium|high) or exact bitrate --referrer [param] Referer to use for emulation of browser requests --start [param] start from specified fragment --useragent [param] User-Agent to use for emulation of browser requests
Proper switch usage
1. Grabbing the manifest and auth parameter with Firefox
HDS Link Detector Add-on
I have also written a pretty basic [Firefox add-on] (https://addons.mozilla.org/addon/hds-link-detector/) to auto-detect HDS links and generate proper command line which you can simply paste in command prompt. Whenever a link is detected it shows a notification which remains visible for few seconds. Clicking on this notification will copy the generated command line to clipboard. I have tested it with pluzz.fr, fora.tv, nrk.no and few other sites and it seems to work pretty well. Though I have no intention to work on it any further it still serves as a good cross-platform helper tool to easily grab HDS videos. Installed add-on will show up in add-on bar (Ctrl + /). Clicking the add-on icon will enable or disable the link detection.
Press Ctrl+Shift+K to open the built-in web console. Type .f4m in search filter to grab the manifest URL.
To grab auth parameter use Seg as search filter and copy only the request parameters.
here foobar can be passed to auth switch.
You can use the play switch to directly pipe the script output to video player of your choice.
php AdobeHDS.php --manifest "manifest_url" --play | mplayer -cache 2048 -
php AdobeHDS.php --manifest "manifest_url" --play | vlc --file-caching=10000 -
You can pass the proxy parameter in any of the following formats:
By default proxy is only used for downloading of manifest but you can use fproxy switch to force the downloading of fragments through proxy.
useragent switch is normally used along with auth parameter. You must use the User-Agent string of the same browser from which you have copied the auth string.
Installing PHP for dummies (Windows only)
Download PHP 5.4 zip package and extract it to C:\PHP folder.
Download PHP.ini and copy it to the same folder.
Right click on "My Computer" and go to Properties->Advanced->Environment Variables and add following string to the end of Path Variable.
- Open cmd prompt and type php -v. If you have done above steps correctly then you will see something like following.
PHP 5.4.37 (cli) (built: Jan 21 2015 01:59:37) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
1. manifest is not downloaded
Error message displayed by AdobeHDS:
Access Denied! Unable to download the manifest.
This most probably means that the manifest authentication token is expired by the time you are trying to use it. Some websites use extremely short-lived authentication tokens, 10 seconds or even less. Try to copy/paste the manifest URL faster.
2. manifest downloads successfully, but fragments do not
Error message displayed by AdobeHDS:
Access Denied! Unable to download fragments.
Look at the --auth switch, under Manual method above. You need to copy/paste the query string from any fragment download in your browser, i.e. the part of the URL after the
?. Example --auth value: