youtube-dl: SSL Error on windows during download [SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:1748)

Make sure you are using the latest version: run youtube-dl --version and ensure your version is 2017.09.02. If it’s not, read this FAQ entry and update. Issues with outdated version will be rejected.

  • I’ve verified and I assure that I’m running youtube-dl 2017.09.02

Before submitting an issue make sure you have:

  • At least skimmed through the README, most notably the FAQ and BUGS sections
  • Searched the bugtracker for similar issues including closed ones

What is the purpose of your issue?

  • Bug report (encountered problems with youtube-dl)
  • Site support request (request for adding support for a new site)
  • Feature request (request for a new functionality)
  • Question
  • Other
C:\...>youtube-dl -i -v -f best --no-check-certificate --write-thumbnail --write-description --write-info-json --download-archive "C:/.../cats/archive.txt" -o "C:/.../cats/%(title)s.%(ext)s" "https://www.youtube.com/watch?v=mdqBbvYX3MU"
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-i', '-v', '-f', 'best', '--no-check-certificate', '--write-thumbnail', '--write-description', '--write-info-json', '--download-archive', 'C:/.../cats/archive.txt', '-o', 'C:/.../cats/%(title)s.%(ext)s', 'https://www.youtube.com/watch?v=mdqBbvYX3MU']
[debug] Encodings: locale cp1250, fs mbcs, out cp852, pref cp1250
[debug] youtube-dl version 2017.09.02
[debug] Python version 3.4.4 - Windows-10-10.0.14393
[debug] exe versions: ffmpeg 3.3.3, ffprobe 3.3.3
[debug] Proxy map: {}
[youtube] mdqBbvYX3MU: Downloading webpage
[youtube] mdqBbvYX3MU: Downloading video info webpage
[youtube] mdqBbvYX3MU: Extracting video information
[youtube] mdqBbvYX3MU: Downloading MPD manifest
[info] Writing video description to: C:\...\cats\How do Cats Use Their Whiskers Slow-Motion - Cats Uncovered - BBC.description
[info] Writing video description metadata as JSON to: C:\...\cats\How do Cats Use Their Whiskers Slow-Motion - Cats Uncovered - BBC.info.json
[youtube] mdqBbvYX3MU: Downloading thumbnail ...
[youtube] mdqBbvYX3MU: Writing thumbnail to: C:\...\cats\How do Cats Use Their Whiskers Slow-Motion - Cats Uncovered - BBC.jpg
[debug] Invoking downloader on 'https://r1---sn-qpbpu8-c0ql.googlevideo.com/videoplayback?lmt=1493417719755362&ei=aPOvWYbPO4-8Vv7cgbAM&ms=au&source=youtube&dur=258.345&mv=m&pl=20&ip=62.165.208.150&requiressl=yes&id=o-AKl7qASm8K0eo_64wWkJMA2reMTE-pWc5MPCRl22oYHU&key=yt6&signature=50EA5A7E2D92F704831176C3873AE8662EC538A7.9414C395E429ECE531C92B02C00F4428924DFA7A&mm=31&mn=sn-qpbpu8-c0ql&mt=1504703234&itag=22&mime=video%2Fmp4&sparams=dur%2Cei%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cexpire&expire=1504724937&initcwndbps=2967500&ratebypass=yes&ipbits=0'
[download] Destination: C:\...\cats\How do Cats Use Their Whiskers Slow-Motion - Cats Uncovered - BBC.mp4
[download]   0.1% of 51.31MiB at  4.12MiB/s ETA 00:12         ERROR: unable to download video data: [SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:1748)
Traceback (most recent call last):
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmptra0egnk\build\youtube_dl\YoutubeDL.py", line 1865, in process_info
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmptra0egnk\build\youtube_dl\YoutubeDL.py", line 1807, in dl
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmptra0egnk\build\youtube_dl\downloader\common.py", line 361, in download
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmptra0egnk\build\youtube_dl\downloader\http.py", line 287, in real_download
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmptra0egnk\build\youtube_dl\downloader\http.py", line 180, in download
  File "C:\Python\Python34\lib\http\client.py", line 537, in read
  File "C:\Python\Python34\lib\http\client.py", line 576, in readinto
  File "C:\Python\Python34\lib\socket.py", line 378, in readinto
  File "C:\Python\Python34\lib\ssl.py", line 748, in recv_into
  File "C:\Python\Python34\lib\ssl.py", line 620, in read
ssl.SSLError: [SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:1748)

Description of your issue, suggested solution and other information

I have been having this issue in the last couple of months. Download starts, then it stops with this error with a farily high likelyhood. One can force himself to download videos even with this bumping up over and over since it can pick up at the last byte it has been left at. Sometimes it is much more frequent than other times. Recently I managed to download a 25GB playlist in 3 tries. However now a 23GB playlist needed 21 tries to complete… Worst is when it doesn’t even get to 1% of the data before it crashes.

I have seen other issues here in the past with similar error message, hence the --no-check-certificate option; I’ve also tried clearing expired certificates. I’ve seen this post linked to somewhere here, it may explain the cause of the problem if it is indeed with youtube-dl and not on my part: https://stackoverflow.com/questions/3724900/python-ssl-problem-with-multiprocessing/3724938#3724938. Any suggestions?

About this issue

Most upvoted comments

If you’re having the same issue I was having, I think I’ve managed to resolve it using this tweak tool:

https://www.speedguide.net/downloads.php

Just use ‘optimal settings’ and everything should work just fine.

I had a similar issue but i’m on windows ubuntu

This fixed it: sudo mkdir /usr/local/share/ca-certificates/cacert.org sudo wget -P /usr/local/share/ca-certificates/cacert.org http://www.cacert.org/certs/root.crt http://www.cacert.org/certs/class3.crt sudo update-ca-certificates

Hope this helps 🥇

I’m on a summer 2020 release and am also getting this issue.

my ‘fix’

youtube-dl -f best -o '%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s' https://www.youtube.com/playlist?list=PL8XX06eOucSzP4iZ3ONvAnG5gt8qLSI5S;
youtube-dl -f best -o '%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s' https://www.youtube.com/playlist?list=PL8XX06eOucSzP4iZ3ONvAnG5gt8qLSI5S;
youtube-dl -f best -o '%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s' https://www.youtube.com/playlist?list=PL8XX06eOucSzP4iZ3ONvAnG5gt8qLSI5S;
# .... and so on
# note the ; at the end 

‘if it works, it’s not stupid’, this worked for me

I have the same issue in 2019.09.12.1. Should I open a new ticket or what?