Is it possible to retrieve only the audio from a youtube video using the java youtube api?
Asked
Active
Viewed 1.3k times
2 Answers
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
-
Hmm, does that not self explaining?:) – head_thrash Jan 30 '14 at 08:07
-
youtube-dl is cool. downloaded the whole playlist easily. It is on github – Tony Mar 03 '15 at 01:53
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.
-
1Well 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