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.

  • 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? – user162573 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

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.


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)..., 2001:1a50:11:0:5f:8f:acaa:177
Connecting to youtube-dl.org (youtube-dl.org)||: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


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).

  • 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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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