Hi! Thanks for visiting my blog. If you've received any value from my content would you mind supporting my new startup by downloading our browser add-on? It's called PriceBlink and makes online shopping a breeze. You can watch it in action here and download it for Chrome, Firefox, IE, or Safari by going to PriceBlink.com. Thank you and I hope you enjoy!

YouTube To Go

Dec 09

Let me start with a disclaimer that I’m not endorsing the distribution of YouTube videos in other video formats or even saving them to your computer. This was simply a proof of concept of taking a video from YouTube and having the ability to watch it offline. Also, with my never-ending quest to master FFmpeg and it’s encoding capabilities I wanted to see if I could encode Flash video files to QuickTime. I’ve spent a lot of time learning how to encode different video formats to FLV and thought it would be interesting to go in the other direction.

This howto was accomplished using the following tools: Live HTTP headers for Firefox and FFmpeg on Linux. I can’t see this being any different for Windows, but would like to hear if the process varies. I decided to start with the crazy video of this guy flying a tiny twin engine airplane:

youtube_airplane.jpg

When the video starts playing a request is made YouTube’s servers asking for the appropriate FLV file. This can be viewed through Live HTTP headers as seen below:

youtube_live_http.gif

If you copy this URL and paste it in your browser you’ll be prompted to save this file to your computer. The original file size for this file was about 8MB. After saving it all you need to do is fire up FFmpeg and run the following command:

ffmpeg -i PlV8WJ6N3nU.flv -ab 32 -ar 22050 -b 256 -s 320×240 youtube.mpg

Let the encoding begin:

youtube_ffmpeg.gif

You can feel free to tweak the values I’ve specified for each of the parameters depending on your desired audio/video quality. The values listed above are ones that I’ve found to deliver a QuickTime video near the same quality as the original. Let me briefly describe the params:

-i input file name
-ab set audio bitrate (in kbit/s)
-ar set audio sampling rate (in Hz)
-b set video bitrate (in kbit/s)
-s set frame size (WxH or abbreviation)
and the last, of course, is the output file name. After encoding the resulting QuickTime file as about 7MB. Now all you need to do is fire up your QuickTime player and watch the vid:

youtube_quicktime.jpg

It shouldn’t take much effort to encode your video to other formats as well.  Since I wanted to watch videos on my Mac I decided to go with QuickTime.  This process is fairly straight forward and feel free to drop me a comment if you have any problems.

One again: I’m not suggesting this is something you should do.  This was a proof of concept to demonstrate the power of FFmpeg and what better place to grab an FLV file then from YouTube.  Enjoy.

One comment

  1. Hey I just discovered your site! Trying to do the same thing with FLV -> 3GP. Can’t get it to generate .3gp files that QT actually recognizes. Any chance you can do a post on how to do that?

    Thanks for the site. Will be bookmarking!

    RC

Trackbacks/Pingbacks

  1. [db75] - dennis baldwin’s thoughts » Blog Archive » Take YouTube Mobile - [...] A reader named Rich recently asked if I’d had any success exporting FLV to 3GPP format. I’ve exported QuickTime ...

Leave a Reply