12

Is it possible to retrieve only the audio from a youtube video using the java youtube api?

Jeff Mercado
  • 121,762
  • 30
  • 236
  • 257
papafe
  • 2,841
  • 4
  • 38
  • 68

2 Answers2

4
sudo apt-get install youtube-dl ffmpeg libavcodec-extra-53 libav-tools

youtube-dl -x --audio-format mp3 --audio-quality 4 http://youtu.be/oRJ0FaOIIbM 
head_thrash
  • 1,595
  • 1
  • 20
  • 26
4

Very similar to How do I programmatically extract the audio from a YouTube video?.

The top answer there is:

Writing an application for this might be overkill. Existing tools already do a pretty good job, and it's hard to beat their simplicity:

wget http://www.youtube.com/get_video.php?video_id=...

| ffmpeg -i - audio.mp3

All done!

If your application needs to do something special with the audio afterwards, it would make sense to write an app for that part. But for just getting the audio out, shelling out to ffmpeg will be a lot easier.

Kudos to John Feminella for the answer.

Community
  • 1
  • 1
Mark Mayo
  • 11,590
  • 12
  • 52
  • 83
  • 1
    Well this isn't exactly what I need, but it's my fault because I've not been precise. I'm working on building a RIA for a school project and I'm using the Echo Nest Api to obtain playlist based on song similarity. I need other api to obtain the mp3 knowing the name of the song. I have to do it when the request is done so i need something different. Thanks for the reply – papafe Dec 06 '10 at 19:06