Skip to content

Saving Ustream videos using ngrep in Ubuntu

April 27, 2013

I came across a wonderful video of a guided meditation by Tenzin Wangyal Rinpoche. He has posted online a large collection of video recordings his teachings and guided meditations.  But I wanted to figure out how convert the Ustream video for listen to on my mp3 player later offline. It also means the meditation won’t be frequently interrupted by the advertisements. 
But first I needed to figure out how to download it!  It turns out it’s easy to do using the terminal in Ubuntu.  It’s like a super jackknife that can do pretty much anything.  People recommended using a URL sniffer to discover the flash video file for downloading.  In Ubuntu this is very easy to do using ngrep.  Here’s how:

Step 1 : open up your terminal and install it if you haven’t already:

$ sudo apt-get install ngrep

Step 2: activate the ngrep command:

$ sudo ngrep -d any '.flv'  port 80

Step 3: reload/refresh the Ustream video page and then look at the ngrep output.  Look through it carefully and you’ll see a section like this:

HTTP/1.1 200 OK..Date: Sat, 27 Apr 2013 56:11 GMT..Server: Apache..X-RSR C: sjc-web048..Content-Length: 112..Keep-Alive: timeout=15, max=200..Connection: Keep-Alive..Content-Type: text/html....http://vodp13.ustream.tv/0/1/1/1419/1419528/1_354487_1419528.flv ############################

There’s the video link you can download using wget or pasting in your browser!

 

Step 4: converting the flash video to mp3 audio:

$ ffmpeg -i 1_354487_1419528.flv -ar 22050 -ab 64k -ac 1 trancending-fear.mp3

This conversion took a few minutes. It greatly reduced the file size from 140mb to 40mb. Now I can listen to it on my mini mp3 player (Sansa Clip+) whenever I like!

Advertisements
3 Comments leave one →
  1. skoteinos permalink
    July 29, 2013 6:47 am

    Thanks, this worked nicely when I wanted to download a talk from ustream.

  2. July 16, 2014 12:09 am

    you’re my hero! i am also using it for meditation related talks. on windows you have to download some crappy software, which is either charged or loaded with malware. on linux it’s so easy.

Trackbacks

  1. Unduh Ustream.TV di Ubuntu Linux | Cotretan

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: