I have try to use ffmpeg to download youtube media in mp3.

ffmpeg -i <url> -f mp3 output.mp3

It's working with other urls, but not with youtube-dl retrived youtube video urls. Ffmpeg returns error 403, forbidden. I can't download also with wget, but from browser and vnc player the url is working. I want to download separatly with ffmpeg, because I don't want to download in original format. Whats the problem? How can I fix it?

The commands:

./youtube-dl -f bestaudio -g https://m.youtube.com/watch?v=D-dONCnY_Yg

ffmpeg -i https://r1---sn-qxo7rn7e.googlevideo.com/videoplayback?signature=021CAFB9066554DD33675D89CC80D6E5FC616A7E.8A6222115FF91416C7F1B639B8F4A86671B40DD2&ipbits=0&sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cip%2Cipbits%2Citag%2Ckeepalive%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Crequiressl%2Csource%2Cexpire&fvip=1&source=youtube&id=o-AALFu428zi6lOqHvA5xGfADpvNCR_BXItpMzqWb73CSH&mm=31%2C26&expire=1520111723&dur=293.721&lmt=1508989837160273&key=yt6&ip= -f mp3 output.mp3

And ffmpeg returns error 403 forbidden.

  • Can't you use youtube --format WHATEVER ... to pick the format you want? Or the appropriate post-processing options? – nohillside Mar 3 '18 at 14:46
  • I can't, because isn't mp3 format. I can use post-processing, but than I need to download before start the conversion. If I download with ffmpeg, I can start plaing in mp3, before the download is finished. – edadam Mar 3 '18 at 14:53
  • No, that's your failure. Just you can't understand the question. – edadam Mar 3 '18 at 14:57
  • @patrix He improved the question. – peterh Mar 3 '18 at 19:37
  • @edadam You can also use youtube-dl -f bestaudio -x --audio-format mp3 --audio-quality 0 [YOUTUBE_URL] to download to mp3 directly – Marware May 16 '18 at 21:09

You forgot to quote the URL given to ffmpeg so the shell's consuming some of the characters as expressions or something else.

ffmpeg -i "https://r1---sn-qxo7rn7e.googlevideo.com/videoplayback?signature=021CAFB9066554DD33675D89CC80D6E5FC616A7E.8A6222115FF91416C7F1B639B8F4A86671B40DD2&ipbits=0&sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cip%2Cipbits%2Citag%2Ckeepalive%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Crequiressl%2Csource%2Cexpire&fvip=1&source=youtube&id=o-AALFu428zi6lOqHvA5xGfADpvNCR_BXItpMzqWb73CSH&mm=31%2C26&expire=1520111723&dur=293.721&lmt=1508989837160273&key=yt6&ip=" output.mp3

Of course, this link has probably expired and you'll need to get a fresh one from youtube-dl.

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.