Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is it possible to convert a youtube video to mp3 using ffmpeg but without youtube-dl to first put in on the server? All the examples I've seen involve youtube-dl first to extract the physical video file.

I don't have access to youtube-dl because I'm on shared web hosting so can't sudo.

share|improve this question
    
The idea of conversion implies there's an input file and an output file. If I understand what you're trying to do, then you want to download MP3 directly from YouTube. JDownloader will do that. –  gronostaj Jun 25 '13 at 16:13
    
there are a lot of ways of downloading and a lot of ways of converting. what OS are you in? –  cipricus Jun 25 '13 at 16:36
    
Can this be done programmatically? –  Someone Jun 25 '13 at 19:48
    
Why can't you use youtube-dl? Perhaps you can edit your post and explain more about your situation so we can give you better answers. –  slhck Jun 25 '13 at 20:21
    
I can't download youtube-dl. I'm on shared web hosting so can't sudo, and tried wgetting to a directory which didn't work –  Someone Jun 25 '13 at 20:24

3 Answers 3

Download video in a specific format from youtube

A browser and application-inspecific way is to use http://deturl.com/. Deturl.com owns both the http://deturl.com/ and http://pwnyoutube.com/ domains. To download a specific youtube video in any format, simply replace the youtube.com portion of the URL with either deturl.com or pwnyoutube.com (my personal fav).

For example, a movie with the URL www.youtube.com/watch?v=abcdefghijk would become www.pwnyoutube.com/watch?v=abcdefghijk. Follow the instructions on the download page to complete the conversion and download.

ALTERNATIVE

Out of interest, I checked on new alternatives and discovered ClipGrab. It, like Miro below, is an open-source and cross-platform application. Unlike Miro, however, it includes a built-in video downloader AND converter, one of which is the MP3 format. It doesn't include as many other conversion types as Miro, but you could always convert it with Miro after download if needed.

Convert a media file into another form/type (video->video, video->audio, or audio->audio)

Download the open-source and cross-platform Miro Video Converter (implements ffmpeg)

"Programmatic access"

To download/convert youtube videos from a command line (with ffmpeg integration), the aforementioned youtube-dl seems to be the best solution.

I'm not certain why sudo is needed to run youtube-dl. I switched over to linux and successfully completed various tasks without sudo or su -c. My output is below. Let us know where you hit a snag at. (echo's are just for comment purposes)

dono@Lonewolf stuff$ echo Download youtube-dl >> /dev/null
dono@Lonewolf stuff$ wget "http://youtube-dl.org/downloads/2013.06.33/youtube-dl"

--2013-06-25 16:37:07--  http://youtube-dl.org/downloads/2013.06.33/youtube-dl
Resolving youtube-dl.org (youtube-dl.org)... 95.143.172.170, 2001:1a50:11:0:5f:8f:acaa:177
Connecting to youtube-dl.org (youtube-dl.org)|95.143.172.170|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 117178 (114K) [application/octet-stream]
Saving to: ‘youtube-dl’

100%[======================================>] 117,178     91.3KB/s   in 1.3s

2013-06-25 16:37:10 (91.3 KB/s) - ‘youtube-dl’ saved [117178/117178]
dono@Lonewolf stuff$ echo Make executable >> /dev/null
dono@Lonewolf stuff$ chmod 764 youtube-dl
dono@Lonewolf stuff$ echo Download sample video >> /dev/null
dono@Lonewolf stuff$ ./youtube-dl http://www.youtube.com/watch?v=IYnsfV5N2n8
[youtube] Setting language
[youtube] IYnsfV5N2n8: Downloading video webpage
[youtube] IYnsfV5N2n8: Downloading video info webpage
[youtube] IYnsfV5N2n8: Extracting video information
[download] Destination: asdfmovie-IYnsfV5N2n8.flv
[download] 100.0% of 5.94MiB at 102.53KiB/s ETA 00:00
dono@Lonewolf stuff$ ls -sh | grep asdf
6.0M asdfmovie-IYnsfV5N2n8.flv
dono@Lonewolf stuff$ echo Download sample video as mp3 if ffmpeg exists >> /dev/null
dono@Lonewolf stuff$ ./youtube-dl -x --audio-format mp3 http://www.youtube.com/watch?v=IYnsfV5N2n8
[youtube] Setting language
[youtube] IYnsfV5N2n8: Downloading video webpage
[youtube] IYnsfV5N2n8: Downloading video info webpage
[youtube] IYnsfV5N2n8: Extracting video information
[download] Destination: asdfmovie-IYnsfV5N2n8.flv
[download] 100.0% of 5.94MiB at 40.83KiB/s ETA 00:00
[ffmpeg] Destination: asdfmovie-IYnsfV5N2n8.mp3
Deleting original file asdfmovie-IYnsfV5N2n8.flv (pass -k to keep)
dono@Lonewolf stuff$ ls -sh | grep asdf
6.0M asdfmovie-IYnsfV5N2n8.flv
1.1M asdfmovie-IYnsfV5N2n8.mp3
dono@Lonewolf stuff$ echo Resolve link for direct download >> /dev/null
dono@Lonewolf stuff$ ./youtube-dl -g http://www.youtube.com/watch?v=IYnsfV5N2n8
http://r12---sn-a5m7lm7z.c.youtube.com/videoplayback?fexp=905619%2C925301%2C914008%2C916612%2C901474%2C921047%2C928201%2C901208%2C929123%2C929915%2C929906%2C929907%2C929125%2C925714%2C929917%2C929919%2C931202%2C912512%2C912515%2C912521%2C906838%2C904488%2C906840%2C931910%2C931913%2C932227%2C904830%2C919373%2C933701%2C904122%2C900816%2C909421%2C912711%2C935000&nh=EAM&ipbits=8&algorithm=throttle-factor&burst=40&id=2189ec7d5e4dda7f&newshard=yes&mt=1372196857&sparams=algorithm%2Cburst%2Ccp%2Cfactor%2Cid%2Cip%2Cipbits%2Citag%2Csource%2Cupn%2Cexpire&cp=U0hWR1JNTl9NS0NONl9KR1JFOjR3WXdZbHR2LUVk&upn=LlOhvm7Kr9s&ip=97.195.135.218&sver=3&factor=1.25&mv=m&key=yt1&expire=1372220481&source=youtube&ms=au&itag=34&signature=4974B24AF7D8D3E239B55CDFDBD284A32734B180.D6A7029322940129A3F37F24BECE6DDE1DA08E61&ratebypass=yes

EDIT:

I think I see what went wrong. You were trying to wget a file to a /bin directory and it required su. If you create the directory ~/bin (e.g. /home/USERNAME/bin), it's still a searchable directory that you have full permissions to.

Assuming you were following the install directions listed at http://rg3.github.io/youtube-dl/download.html, run mkdir ~/bin and replace all instances of /usr/local/bin/youtube-dl with ~/bin/youtube-dl instead. I can verify that this works on my shared hosting provider (Arvixe).

share|improve this answer
    
With pwnyoutube, is it possible to do a wget and save the video somewhere else programmatically? –  Someone Jun 25 '13 at 19:51
    
Is it possible? –  Someone Jun 25 '13 at 22:09
    
From what I can tell, pwnyoutube doesn't give you a direct link, which is required for wget and programmatic access. Technically, wget can resolve a youtube link directly (albeit with SEVERAL parameters), but every time the site changes it will need a new slew of options. That's the benefit of dedicated youtube handlers -- they update. Programmatically, I think your best option is youtube-dl. Updating answer for troubleshooting. –  Dono Jun 25 '13 at 22:43

Install Firefox and then the FlashGot extension.

share|improve this answer
1  
The OP is on a shared web host, so they need it command-line only. –  slhck Jun 26 '13 at 9:06

Get another web host. Unless you're going for ultra low budget, you can find many virtual private servers (VPS) at an affordable rate. I had my web host install various command line utilities such as rsync for free. I'm sure youtube-dl is technically trivial, but you may run into copyright issues.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.