DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: alias: download youtube video as mp3 audio file with youtube-dl and ffmpeg  (Read 9,731 times)

Nod5

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,175
    • Coding Snacks
    • Participated in NANY Challenge Three Times
    • Plugin Coding Medal
This alias lets you enter
Code
yt https://www.youtube.com/watch?v=dQw4w9WgXcQ
in FARR to download that youtube content to an mp3 audio file.

This requires the tools youtube-dl (to download the youtube content) and ffmpeg (to convert to mp3).
youtube-dl , http://rg3.github.io/youtube-dl/download.html
ffmpeg , http://ffmpeg.zeranoe.com/builds/ (get the Static build)

alias name
Code
youtube-dl to mp3
regular expression pattern
Code
^(?:y|yt|you) (.*(?:youtu.be|youtube.com).*)$
Results
Code
youtube-dl mp3 $$1 | C:\folder\youtube-dl.exe --restrict-filenames -o "C:\output\`%(title)s.`%(ext)s" --write-thumbnail --ffmpeg-location "C:\folder\ffmpeg.exe" -f "bestaudio[ext=m4a]" -x --audio-format mp3 --audio-quality 0 --embed-thumbnail $$1

Note: change the two instances of "C:\folder\" to where you have put youtube-dl.exe and ffmpeg.exe (and ffprobe.exe and ffplay.exe from the same package) and change "C:\output\" to what folder you want the mp3 file to end up in.

I also made a short video tutorial on how to do these setup steps, view it here
https://www.youtube.com/watch?v=dQw4w9WgXcQ

tomos

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 11,970
    • Gathering Badge
    • Participated in NANY Challenge Once
Looking forward to trying this.

I also made a short video tutorial on how to do these setup steps, view it here
https://www.youtube.com/watch?v=dQw4w9WgXcQ
did I just get rickrolled  :tellme: ;D

the only reason I ask is: The uploader has not made this video available in your country.
Sorry about that.

Edit// but I guess if it looks like a duck, it probably walks sings like one too ;-)
Tom
« Last Edit: January 05, 2016, 09:15 PM by tomos »

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,931
    • Gathering Badge
    • Plugin Coding Medal
    • Participated in NANY Challenge Seventeen Times
    • Cody Award
    • Coding Snacks
    • Volunteers/Staff
thanks for the alias -- that's useful!  as tomos points out, the video is not correct (or was a joke?).

Nod5

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,175
    • Coding Snacks
    • Participated in NANY Challenge Three Times
    • Plugin Coding Medal
did I just get rickrolled  :tellme: ;D
Hehe. I first needed a youtube url to simply illustrate the command and that was the first one that came to mind. But then I thought, when I already have it at hand why not ... roll with it?  8)

tomos

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 11,970
    • Gathering Badge
    • Participated in NANY Challenge Once
^ it's been a while :D :Thmbsup:
Tom

Original address: https://www.donationcoder.com/forum/index.php?topic=42164.0