Tuesday, August 30, 2016

Download BrightCove videos tutorial

Download BrightCove videos tutorial



Update:  The download method described in my original post no longer works.  It looks like theyve updated their delivery system to incorporate additional security measures.  Fortunately, theres an easier rtmpdump method that still works:

0.  if you dont already have it, install the rtmpdump suite:
sudo apt-get install rtmpdump
1. open a terminal and become root:
sudo su - root
2. create a firewall rule to temporarily redirect TCP traffic to a custom port:
iptables -t nat -A OUTPUT -p tcp --dport 1935 -m owner ! --uid-owner root -j REDIRECT
3. run a (cleverly named) companion program in the rtmpdump package that sniffs traffic for streaming video
rtmpsuck
4. minimize the root terminal window and then open (or refresh) the video page in your browser and play the video

5. bring up the root terminal window and when it says "Closing connection... done!" (or the video finishes playing) press Ctrl+C to stop rtmpsuck

6. the video will have been saved in the root users home directory; move it to tmp (note: if the source video is flv, swf, etc. you will need to change the extension in the command below)
mv ~/*.mp4 /tmp
7. delete the temporary firewall rule
iptables -t nat -D OUTPUT -p tcp --dport 1935 -m owner ! --uid-owner root -j REDIRECT
8. close the root terminal window and enjoy your video!


P.S. This works for other video sites as well, such as News and Sports broadcasts.

______________________________

Legacy (non-working) instructions for reference:

KeepVid makes it super easy to download videos from Youtube, Dailymotion, Metacafe, and iFilm, but it doesnt support BrightCove.

Most BrightCove flash-based videos have an HTML5 (iPad/iPhone) alternate so the process is a little technical but relatively easy to do.  But what if you follow those instructions and no HTML5 video appears?  Well, that means there is no HTML5 alternate.  In that case, the process gets a little harder but not impossible:

1.  Install rtmpdump: sudo apt-get install rtmpdump
2.  In Chrome, press F12 to open the browser developer tools and click on the Network tab
3.  Start playing the video and look for entries in the Network list that start with 9.gif?a=
4.  Click on one and view the Headers and it should look something like this (color-coded to highlight important info):

https://ma156-r.analytics.edgekey.net/9.gif?a=P~b=6ca41fbb12c742746~c=B52593FBC2ADBE676E7B7420EBF8913D8734A47F~d=C95E2AB3C06C42881C40741832462822EC385E99~e=2~f=R~g=0~h=1.2~i=1.1~k=B98698AD2185209EFAAC0ADFB1D982CFF7C42761~ag=www.lds.org~al=Linux~_cd_1557=624246188001~m=PL~n=52386913.1305:9~r=43657:9~s=43423:9~t=30064770995:9~u=0~v=4592~w=6087~x=5174~y=4591~z=0~aa=cp168414.edgefcs.net~ac=&mp4:66852713001/66852713001_2008369076001_2007-04-004-the-district-2-episode-1-8000k-eng.mp4~ad=1935~ae=rtmp~af=https://sadmin.brightcove.com/%5B%5BIMPORT%5D%5D/79423.analytics.edgekey.net/csma/brightcove/BrightcoveCSMALoader.swf~ai=Mozilla/5.0%20(X11;%20Linux%20x86_64)%20AppleWebKit/537.36%20(KHTML,%20like%20Gecko)%20Ubuntu%20Chromium/30.0.1599.114%20Chrome/30.0.1599.114%20Safari/537.36~aj=11,2,202,310~ak=Flash_PlugIn~am=D~an=309~ao=607~ap=916~ar=0~at=Chrome%2030~au=1425*469~aw=rtmp://cp168414.edgefcs.net/ondemand/&mp4:66852713001/66852713001_2008369076001_2007-04-004-the-district-2-episode-1-8000k-eng.mp4?__nn__=1701429841001&slist=66852713001/&auth=daEbuc0awbycaa1bTbaaxcucucxdqcdavbh-bsJdpa-bWG-knzAtqvy_yDyr_umE_AEvA_GsD&aifp=bcosldsuds~ay=csma-3.4.6:brightcoveLoader-1.0.27~az=1.0~ba=900000~cm=Akamai~da=0~db=164.0757:9~dc=0~dd=0~de=0~dg=0~dh=0~dl=43657:9~dn=0:9~do=0~dp=0~dq=3764582~du=72000:9~dv=1~dx=5.166~ea=10~eb=1:0.0051~en=The%20District%202%20Episode%201~fb=0~fd=0~fe=0~ff=0~fg=0,0,0,0~fh=0,0,0,0~fi=8317000:0:5169::1~fj=8317000:5169~fl=42990573000:5169

5. Stop the video playing in the browser
6.  Open a command prompt and craft a rtmpdump command like:

rtmpdump -r "rtmp://cp168414.edgefcs.net/" -y "mp4:66852713001/66852713001_2008369076001_2007-04-004-the-district-2-episode-1-8000k-eng.mp4" -a "ondemand?auth=daEbuc0awbycaa1bTbaaxcucucxdqcdavbh-bsJdpa-bWG-knzAtqvy_yDyr_umE_AEvA_GsD&aifp=bcosldsuds&slist=66852713001/" -o my_downloaded_video.mp4


That should connect to the video server and begin downloading the file!

Once done, feel free to create a DVD

Available link for download