creating an audio bootleg from youtube

2010-05-08

Tools required:

  • The internet

  • A quality *nix OS (FreeBSD in this case)

  • youtube-dl, available in FreeBSD under ports/www/youtube_dl/

  • ffmpeg, available in FreeBSD under ports/multimedia/ffmpeg/

First thing is first, find a really cool youtube clip. If you dont know of one already, use a Buckethead Song (Volume warning, this clip was mixed “hot”, so turn your speakers down):

Watch the drummer (Bryan Mantia) go crazy in the background, pretty intense.

Now, use ‘youtube-dl’, which is pretty simple, the main argument it accepts is a URL of the youtube clip in question, and it saves it as a Flash Video file.

[server] 3:41pm: ~>youtube-dl 'http://www.youtube.com/watch?v=61k041I4aEo'
[youtube] Setting language
[youtube] 61k041I4aEo: Downloading video info webpage
[youtube] 61k041I4aEo: Extracting video information
[download] Destination: 61k041I4aEo.flv
[download] 100.0% of 8.04M at   57.33k/s ETA 00:00

Next, use ffmpeg to save the audio stream as a mp3 file:

[server] 3:45pm: ~>ffmpeg -i 61k041I4aEo.flv -ab 128000 -ar 44100 interworld_and_the_new_innocence.mp3
FFmpeg version 0.5.1, Copyright (c) 2000-2009 Fabrice Bellard, et al.
  libavutil     49.15. 0 / 49.15. 0
  libavcodec    52.20. 1 / 52.20. 1
  libavformat   52.31. 0 / 52.31. 0
  libavdevice   52. 1. 0 / 52. 1. 0
  libavfilter    0. 4. 0 /  0. 4. 0
  libswscale     0. 7. 1 /  0. 7. 1
  libpostproc   51. 2. 0 / 51. 2. 0
  built on May  8 2010 15:43:57, gcc: 4.2.1 20070719  [FreeBSD]

Seems stream 0 codec frame rate differs from container frame rate: 1000.00 (1000/1) -> 29.92 (359/12)
Input #0, flv, from '61k041I4aEo.flv':
  Duration: 00:03:38.24, start: 0.000000, bitrate: 306 kb/s
    Stream #0.0: Video: flv, yuv420p, 320x218, 242 kb/s, 29.92 tbr, 1k tbn, 1k tbc
    Stream #0.1: Audio: mp3, 22050 Hz, mono, s16, 64 kb/s
Output #0, mp3, to 'interworld_and_the_new_innocence.mp3':
    Stream #0.0: Audio: libmp3lame, 44100 Hz, mono, s16, 128 kb/s
Stream mapping:
  Stream #0.1 -> #0.0
Press [q] to stop encoding
size=    3411kB time=218.31 bitrate= 128.0kbits/s
video:0kB audio:3411kB global headers:0kB muxing overhead 0.000916%

Verify the file with file(1), or listen to the newly saved mp3 file over and over and over and over and over and over again.

[server] 3:45pm: ~>file interworld_and_the_new_innocence.mp3
interworld_and_the_new_innocence.mp3: Audio file with ID3 version 2.4.0, contains: MPEG ADTS, layer III, v1, 128 kbps, 44.1 kHz, Monaural