You can use this script to download a flash file from YouTube:
http://www.catonmat.net/blog/revisiting-gnu-awk-youtube-video-downloader/
To run this script, just do
gawk -f path/to/get_youtube_vids.awk url/to/youtube/page
e.g.
gawk -f ./get_youtube_vids.awk http://www.youtube.com/watch?v=N_AqSbgMMS8
Copy the url out of the location bar of the browser. This created a file named N_AqSbgMMS8.flv in the current directory. This script should show progress, but that part seems to be broke. It'll claim to be at 0% for the entire download. It's better to check the file system for progress.
To dump the audio portion of the file, run ffmpeg from the command line. First do this:
ffmpeg -i N_AqSbgMMS8.flv
and see something like this:
Seems stream 0 codec frame rate differs from container frame rate: 1000.00 (1000/1) -> 25.00 (25/1)
Input #0, flv, from 'N_AqSbgMMS8.flv':
Duration: 00:08:16.36, start: 0.000000, bitrate: 103 kb/s
Stream #0.0: Video: flv, yuv420p, 320x240, 95 kb/s, 25 tbr, 1k tbn, 1k tbc
Stream #0.1: Audio: mp3, 22050 Hz, stereo, s16, 8 kb/s
At least one output file must be specified
Then run this:
ffmpeg -i N_AqSbgMMS8.flv -vn -ar 22050 -ac 2 -ab 64 -f ogg bettername.ogg
-vn means no video
-ar means audio sampling frequency, set it to the same as in the output from ffmpeg -i
-ac means the number of channels, so if ffmpeg says 'stereo', use 2, if ffmpeg says 'mono', use 1
-ab is bit rate, the default is 64k
-f is the output format. "mp3" could be used in place of "ogg", but the restricted codecs would need to be installed. You can check the supported formats by running 'ffmpeg -formats'.
The ogg output produces a file that is a little weird. mplayer plays it from the command line just fine. Exaile adds it to the playlist, but the line in the playlist is blank. Exaile does play the file, though. Aqualung doesn't even seem to be able to load the file at all. No complaints from vlc.
To install the restricted formats, google around for "ubuntu restricted codecs" to find suitable instructions. After that, use synaptic to install both libavcodec-extra-52 and libavformat-extra-52 on Ubuntu 9.10. The mp3 file that is created works on all 4 of the players I tested, although Exaile still shows a blank line in the playlist. Maybe that's just a bug in Exaile.
No comments:
Post a Comment