52

I can create an mp3 of a YouTube video with the following command:

youtube-dl --extract-audio --audio-format mp3 http://www.youtube.com/watch?v=rtOvBOTyX00

It creates an mp3 with the following filename:

Christina Perri - A Thousand Years [Official Music Video]-rtOvBOTyX00.mp3

I don't need the video ID part (rtOvBOTyX00) at the end and would like to have just the following:

Christina Perri - A Thousand Years [Official Music Video].mp3

Is this achievable with youtube-dl's options? If not, what's the next best solution?

4 Answers4

54

Try the command

youtube-dl --extract-audio --audio-format mp3 --output "%(uploader)s%(title)s.%(ext)s" http://www.youtube.com/watch?v=rtOvBOTyX00
Maythux
  • 87,123
27

As you could reed in the youtube-dl manpage the corresponding option would be -o :

youtube-dl --extract-audio --audio-format mp3 -o "%(title)s.%(ext)s" http://www.youtube.com/watch?v=rtOvBOTyX00
Ben
  • 623
3

You can specify name by using argument --output and then specifying the name in the following syntax in place of specific_name

youtube-dl https://www.youtube.com/watch?v=iuJDhFRDx9M -x --audio-format mp3 --output "specific_name.%(ext)s"
0

Escape your percent signs, so %(title)s becomes %%(title)s. I had this issue myself.