14

Is it possible to download a YouTube video as e.g. mp3 and then convert it to flac with ffmpeg? I can specify the arguments that ffmpeg shall use after the download with --postprocessor-args but I don't know how to get the file name there.

--postprocessor-args "-i downloadedfile.xxx -c:a flac downloadedfile.flac"

This would be the argument I want to use. Is this possible?

jkmartindale
  • 523
  • 2
  • 9
  • 22
Urasam
  • 169
  • 1
  • 1
  • 8

1 Answers1

32

Starting with youtube-dl 2017.03.16 - or right now if you check out the git repository - you can simply pass in --extract-audio --audio-format flac, as in:

youtube-dl -x --audio-format flac  https://www.youtube.com/watch?v=BaW_jenozKc

(-x is short for --extract-audio.)

  • Thank you so much! I will try it immediately when I get home and mark the answer. I've done python so it would've taken me a while to get the hang of it I guess. – Urasam Mar 16 '17 at 12:11
  • Since I don't know how to build my own version, I'm gonna wait this 10 days. Thanks again for your commit! – Urasam Mar 16 '17 at 15:27
  • 1
    2016.03.25 was just a conservative guess from me. youtube-dl 2017.03.16 - released just now - already contains flac support. See the [FAQ](https://yt-dl.org/update) if you need help updating. –  Mar 16 '17 at 15:56