ValueError: AES key must be either 16, 24, or 32 bytes long #17420

Closed
opened 2026-02-21 09:29:19 -05:00 by deekerman · 19 comments
Owner

Originally created by @singhal-shagun on GitHub (Jul 16, 2019).

Checklist

  • I'm asking a question
  • I've looked through the README and FAQ for similar questions
  • I've searched the bugtracker for similar questions including closed ones

Question

Please help me diagnose this error log and enlighten me with what I need to do to download the complete video. Any help would be much appreciated!

C:\Users\AAI-Shagun\AppData\Roaming\youtube-dlg>youtube-dl.exe --hls-prefer-native --hls-use-mpegts -v "https://5ad66d227b0c1.streamlock.net/edusecure/_definist/64/1212/5042/121513/64_1212_5042_121513_0.mp4/chunklist_w1422491268.m3u8?isPrimary=true&ref=http%3A%2F%2Ftheiashub.edugyaan.com&sessionId=1l0gahmb2ueads99d190bfcnn4&userId=231644&username=singhal.shagun%40gmail.com&videoId=121513"
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['--hls-prefer-native', '--hls-use-mpegts', '-v', 'https://5ad66d227b0c1.streamlock.net/edusecure/_definist/64/1212/5042/121513/64_1212_5042_121513_0.mp4/chunklist_w1422491268.m3u8?isPrimary=true&ref=http%3A%2F%2Ftheiashub.edugyaan.com&sessionId=1l0gahmb2ueads99d190bfcnn4&userId=231644&username=singhal.shagun%40gmail.com&videoId=121513']
[debug] Encodings: locale cp1252, fs mbcs, out cp437, pref cp1252
[debug] youtube-dl version 2019.07.16
[debug] Python version 3.4.4 (CPython) - Windows-10-10.0.14393
[debug] exe versions: ffmpeg 3.2.4, ffprobe 3.2.4, rtmpdump 2.4
[debug] Proxy map: {}
[generic] chunklist_w1422491268.m3u8?isPrimary=true&ref=http://theiashub.edugyaan.com&sessionId=1l0gahmb2ueads99d190bfcnn4&userId=231644&username=singhal.shagun@gmail: Requesting header
[generic] chunklist_w1422491268.m3u8?isPrimary=true&ref=http://theiashub.edugyaan.com&sessionId=1l0gahmb2ueads99d190bfcnn4&userId=231644&username=singhal.shagun@gmail: Downloading m3u8 information
[debug] Default format spec: bestvideo+bestaudio/best
[debug] Invoking downloader on 'https://5ad66d227b0c1.streamlock.net/edusecure/_definist/64/1212/5042/121513/64_1212_5042_121513_0.mp4/chunklist_w1422491268.m3u8?isPrimary=true&ref=http%3A%2F%2Ftheiashub.edugyaan.com&sessionId=1l0gahmb2ueads99d190bfcnn4&userId=231644&username=singhal.shagun%40gmail.com&videoId=121513'
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 1016
[download] Destination: chunklist_w1422491268-chunklist_w1422491268.m3u8isPrimary=true&ref=http -theiashub.edugyaan.com&sessionId=1l0gahmb2ueads99d190bfcnn4&userId=231644&username=singhal.shagun@gmail.mp4
[download] 2.7% of ~687.24MiB at Unknown speed ETA Unknown ETATraceback (most recent call last):
File "main.py", line 19, in
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpaxmfe_l6\build\youtube_dl_init
.py", line 474, in main
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpaxmfe_l6\build\youtube_dl_init
.py", line 464, in _real_main
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpaxmfe_l6\build\youtube_dl\YoutubeDL.py", line 2008, in download
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpaxmfe_l6\build\youtube_dl\YoutubeDL.py", line 807, in extract_info
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpaxmfe_l6\build\youtube_dl\YoutubeDL.py", line 861, in process_ie_result
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpaxmfe_l6\build\youtube_dl\YoutubeDL.py", line 1642, in process_video_result
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpaxmfe_l6\build\youtube_dl\YoutubeDL.py", line 1915, in process_info
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpaxmfe_l6\build\youtube_dl\YoutubeDL.py", line 1854, in dl
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpaxmfe_l6\build\youtube_dl\downloader\common.py", line 366, in download
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpaxmfe_l6\build\youtube_dl\downloader\hls.py", line 174, in real_download
File "C:\Python\Python34\lib\site-packages\Crypto\Cipher\AES.py", line 95, in new
File "C:\Python\Python34\lib\site-packages\Crypto\Cipher\AES.py", line 59, in init
File "C:\Python\Python34\lib\site-packages\Crypto\Cipher\blockalgo.py", line 141, in init
ValueError: AES key must be either 16, 24, or 32 bytes long

C:\Users\AAI-Shagun\AppData\Roaming\youtube-dlg>

Originally created by @singhal-shagun on GitHub (Jul 16, 2019). <!-- ###################################################################### WARNING! IGNORING THE FOLLOWING TEMPLATE WILL RESULT IN ISSUE CLOSED AS INCOMPLETE ###################################################################### --> ## Checklist <!-- Carefully read and work through this check list in order to prevent the most common mistakes and misuse of youtube-dl: - Look through the README (http://yt-dl.org/readme) and FAQ (http://yt-dl.org/faq) for similar questions - Search the bugtracker for similar questions: http://yt-dl.org/search-issues - Finally, put x into all relevant boxes (like this [x]) --> - [x] I'm asking a question - [x] I've looked through the README and FAQ for similar questions - [x] I've searched the bugtracker for similar questions including closed ones ## Question <!-- Ask your question in an arbitrary form. Please make sure it's worded well enough to be understood, see https://github.com/ytdl-org/youtube-dl#is-the-description-of-the-issue-itself-sufficient. --> Please help me diagnose this error log and enlighten me with what I need to do to download the complete video. Any help would be much appreciated! C:\Users\AAI-Shagun\AppData\Roaming\youtube-dlg>youtube-dl.exe --hls-prefer-native --hls-use-mpegts -v "https://5ad66d227b0c1.streamlock.net/edusecure/_definist/64/1212/5042/121513/64_1212_5042_121513_0.mp4/chunklist_w1422491268.m3u8?isPrimary=true&ref=http%3A%2F%2Ftheiashub.edugyaan.com&sessionId=1l0gahmb2ueads99d190bfcnn4&userId=231644&username=singhal.shagun%40gmail.com&videoId=121513" [debug] System config: [] [debug] User config: [] [debug] Custom config: [] [debug] Command-line args: ['--hls-prefer-native', '--hls-use-mpegts', '-v', 'https://5ad66d227b0c1.streamlock.net/edusecure/_definist/64/1212/5042/121513/64_1212_5042_121513_0.mp4/chunklist_w1422491268.m3u8?isPrimary=true&ref=http%3A%2F%2Ftheiashub.edugyaan.com&sessionId=1l0gahmb2ueads99d190bfcnn4&userId=231644&username=singhal.shagun%40gmail.com&videoId=121513'] [debug] Encodings: locale cp1252, fs mbcs, out cp437, pref cp1252 [debug] youtube-dl version 2019.07.16 [debug] Python version 3.4.4 (CPython) - Windows-10-10.0.14393 [debug] exe versions: ffmpeg 3.2.4, ffprobe 3.2.4, rtmpdump 2.4 [debug] Proxy map: {} [generic] chunklist_w1422491268.m3u8?isPrimary=true&ref=http://theiashub.edugyaan.com&sessionId=1l0gahmb2ueads99d190bfcnn4&userId=231644&username=singhal.shagun@gmail: Requesting header [generic] chunklist_w1422491268.m3u8?isPrimary=true&ref=http://theiashub.edugyaan.com&sessionId=1l0gahmb2ueads99d190bfcnn4&userId=231644&username=singhal.shagun@gmail: Downloading m3u8 information [debug] Default format spec: bestvideo+bestaudio/best [debug] Invoking downloader on 'https://5ad66d227b0c1.streamlock.net/edusecure/_definist/64/1212/5042/121513/64_1212_5042_121513_0.mp4/chunklist_w1422491268.m3u8?isPrimary=true&ref=http%3A%2F%2Ftheiashub.edugyaan.com&sessionId=1l0gahmb2ueads99d190bfcnn4&userId=231644&username=singhal.shagun%40gmail.com&videoId=121513' [hlsnative] Downloading m3u8 manifest [hlsnative] Total fragments: 1016 [download] Destination: chunklist_w1422491268-chunklist_w1422491268.m3u8isPrimary=true&ref=http -__theiashub.edugyaan.com&sessionId=1l0gahmb2ueads99d190bfcnn4&userId=231644&username=singhal.shagun@gmail.mp4 [download] 2.7% of ~687.24MiB at Unknown speed ETA Unknown ETATraceback (most recent call last): File "__main__.py", line 19, in <module> File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpaxmfe_l6\build\youtube_dl\__init__.py", line 474, in main File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpaxmfe_l6\build\youtube_dl\__init__.py", line 464, in _real_main File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpaxmfe_l6\build\youtube_dl\YoutubeDL.py", line 2008, in download File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpaxmfe_l6\build\youtube_dl\YoutubeDL.py", line 807, in extract_info File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpaxmfe_l6\build\youtube_dl\YoutubeDL.py", line 861, in process_ie_result File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpaxmfe_l6\build\youtube_dl\YoutubeDL.py", line 1642, in process_video_result File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpaxmfe_l6\build\youtube_dl\YoutubeDL.py", line 1915, in process_info File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpaxmfe_l6\build\youtube_dl\YoutubeDL.py", line 1854, in dl File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpaxmfe_l6\build\youtube_dl\downloader\common.py", line 366, in download File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpaxmfe_l6\build\youtube_dl\downloader\hls.py", line 174, in real_download File "C:\Python\Python34\lib\site-packages\Crypto\Cipher\AES.py", line 95, in new File "C:\Python\Python34\lib\site-packages\Crypto\Cipher\AES.py", line 59, in __init__ File "C:\Python\Python34\lib\site-packages\Crypto\Cipher\blockalgo.py", line 141, in __init__ ValueError: AES key must be either 16, 24, or 32 bytes long C:\Users\AAI-Shagun\AppData\Roaming\youtube-dlg>
deekerman 2026-02-21 09:29:19 -05:00
Author
Owner

@dstftw commented on GitHub (Jul 16, 2019):

Most likely broken key URL in manifest.

@dstftw commented on GitHub (Jul 16, 2019): Most likely broken key URL in manifest.
Author
Owner

@singhal-shagun commented on GitHub (Jul 16, 2019):

I am able to watch the videos just fine in the browser. However, when I try to download them, I get this error. Also, this error occurs irrespective of which video I try to download and irrespective of whether I try to download using the playlist.m3u8 file or the chunklist_w*********.m3u8 file.

For further diagnosis' sake, please find the URLs in the attached excel file.
URLs.xlsx

I need to download the videos because there's a limit that I can watch videos only up to 4 times on the website.

@singhal-shagun commented on GitHub (Jul 16, 2019): I am able to watch the videos just fine in the browser. However, when I try to download them, I get this error. Also, this error occurs irrespective of which video I try to download and irrespective of whether I try to download using the playlist.m3u8 file or the chunklist_w*********.m3u8 file. For further diagnosis' sake, please find the URLs in the attached excel file. [URLs.xlsx](https://github.com/ytdl-org/youtube-dl/files/3399838/URLs.xlsx) I need to download the videos because there's a limit that I can watch videos only up to 4 times on the website.
Author
Owner

@remitamine commented on GitHub (Jul 17, 2019):

I think the key request, requires specific cookies/headers, try to pass them with --cookies/--add-header option.

@remitamine commented on GitHub (Jul 17, 2019): I think the key request, requires specific cookies/headers, try to pass them with `--cookies`/`--add-header` option.
Author
Owner

@singhal-shagun commented on GitHub (Jul 17, 2019):

I think the key request, requires specific cookies/headers, try to pass them with --cookies/--add-header option.

The cookies.txt extension for Chrome says that:
# HTTP Cookie File by Genuinous @genuinous.
# No cookies for edugyaan.com.
# Download all cookies.

Regarding the possible requirement of a specific header, youtube-dl is using:
"http_headers": { "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.96 Safari/537.36", "Accept-Encoding": "gzip, deflate", "Accept-Charset": "ISO-8859-1,utf-8;q=0.7,*;q=0.7", "Accept-Language": "en-us,en;q=0.5" }

Chrome, however, showed me these Headers:
Capture

Which of the Chrome headers do I need to pass along? And is there a more efficient way to pass them than typing each of them in the command using --add-header?

@singhal-shagun commented on GitHub (Jul 17, 2019): > I think the key request, requires specific cookies/headers, try to pass them with `--cookies`/`--add-header` option. The cookies.txt extension for Chrome says that: `# HTTP Cookie File by Genuinous @genuinous.` `# No cookies for edugyaan.com.` `# Download all cookies.` Regarding the possible requirement of a specific header, youtube-dl is using: `"http_headers": { "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.96 Safari/537.36", "Accept-Encoding": "gzip, deflate", "Accept-Charset": "ISO-8859-1,utf-8;q=0.7,*;q=0.7", "Accept-Language": "en-us,en;q=0.5" }` Chrome, however, showed me these Headers: ![Capture](https://user-images.githubusercontent.com/20037489/61359307-ae585d00-a899-11e9-8237-c517a9e605b0.PNG) Which of the Chrome headers do I need to pass along? And is there a more efficient way to pass them than typing each of them in the command using `--add-header`?
Author
Owner

@remitamine commented on GitHub (Jul 17, 2019):

Which of the Chrome headers do I need to pass along?

the headers you're looking at are not the ones that I'm referring to, I said the headers of the key request, not the manifest request(in the screenshot it contains authenticate?wowzasessionid...), and you have to try I can't tell which one to use, it depends on the website.

And is there a more efficient way to pass them than typing each of them in the command using --add-header?

by adding support for the original website.

@remitamine commented on GitHub (Jul 17, 2019): > Which of the Chrome headers do I need to pass along? the headers you're looking at are not the ones that I'm referring to, I said the headers of the key request, not the manifest request(in the screenshot it contains `authenticate?wowzasessionid...`), and you have to try I can't tell which one to use, it depends on the website. > And is there a more efficient way to pass them than typing each of them in the command using --add-header? by adding support for the original website.
Author
Owner

@singhal-shagun commented on GitHub (Jul 17, 2019):

@remitamine
I see that you added the 'account needed' label. The credentials may be found in the excel below.

@singhal-shagun commented on GitHub (Jul 17, 2019): @remitamine I see that you added the 'account needed' label. The credentials may be found in the excel below.
Author
Owner

@remitamine commented on GitHub (Jul 17, 2019):

don't post credentials publically, it's better to change the password.

@remitamine commented on GitHub (Jul 17, 2019): don't post credentials publically, it's better to change the password.
Author
Owner

@singhal-shagun commented on GitHub (Jul 17, 2019):

@remitamine
After logging into the account, follow these steps:

  1. Click on "Quality Enrichment Programme (QEP) - Basic".
  2. Click on "1. Full Course : QEP"
  3. From the list on the right hand side, click on "QEP Basic Session 4 - June 26".

Just to remind you, please don't play a video because I can play a video 4 times only. You can get the manifest URL etc, without actually playing any video... it starts loading them automatically.

@singhal-shagun commented on GitHub (Jul 17, 2019): @remitamine After logging into the account, follow these steps: 1. Click on "Quality Enrichment Programme (QEP) - Basic". 2. Click on "1. Full Course : QEP" 3. From the list on the right hand side, click on "QEP Basic Session 4 - June 26". Just to remind you, please don't play a video because I can play a video 4 times only. You can get the manifest URL etc, without actually playing any video... it starts loading them automatically.
Author
Owner

@singhal-shagun commented on GitHub (Jul 17, 2019):

I get ERROR: batch file could not be read when I run the following command:

youtube-dl.exe --add-header "Request Method":"GET" --add-header "Remote Address":"3.0.51.212:443" --add-header "Referrer Policy":"no-referrer-when-downgrade" --add-header "Accept":"*/*" --add-header "Accept-Encoding":"gzip, deflate" -add-header "Accept-Language":"en-US,en;q=0.9" --add-header "Connection":"keep-alive" --add-header "Cookie":"PHPSESSID=jnottoh8pfgqvq7gekf4bq1qf5" --add-header "DNT":"1" --add-header "Host":"theiashub.edugyaan.com" --add-header "Referer":"http://theiashub.edugyaan.com/video/embededView/120418" "https://5ad66d227b0c1.streamlock.net/edusecure/_definist/64/1212/5042/120418/64_1212_5042_120418_0.mp4/chunklist_w1289291518.m3u8?isPrimary=true&ref=http%3A%2F%2Ftheiashub.edugyaan.com&sessionId=jnottoh8pfgqvq7gekf4bq1qf5&userId=231644&username=singhal.shagun%40gmail.com&videoId=120418" --hls-prefer-native --hls-use-mpegts --add-header "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36"

Any ideas?

@singhal-shagun commented on GitHub (Jul 17, 2019): I get `ERROR: batch file could not be read` when I run the following command: `youtube-dl.exe --add-header "Request Method":"GET" --add-header "Remote Address":"3.0.51.212:443" --add-header "Referrer Policy":"no-referrer-when-downgrade" --add-header "Accept":"*/*" --add-header "Accept-Encoding":"gzip, deflate" -add-header "Accept-Language":"en-US,en;q=0.9" --add-header "Connection":"keep-alive" --add-header "Cookie":"PHPSESSID=jnottoh8pfgqvq7gekf4bq1qf5" --add-header "DNT":"1" --add-header "Host":"theiashub.edugyaan.com" --add-header "Referer":"http://theiashub.edugyaan.com/video/embededView/120418" "https://5ad66d227b0c1.streamlock.net/edusecure/_definist/64/1212/5042/120418/64_1212_5042_120418_0.mp4/chunklist_w1289291518.m3u8?isPrimary=true&ref=http%3A%2F%2Ftheiashub.edugyaan.com&sessionId=jnottoh8pfgqvq7gekf4bq1qf5&userId=231644&username=singhal.shagun%40gmail.com&videoId=120418" --hls-prefer-native --hls-use-mpegts --add-header "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36"` Any ideas?
Author
Owner

@remitamine commented on GitHub (Jul 17, 2019):

the manifests served from this website are (partially) encode parts of the Key URL.
you can try to use this patch to correct the key URL and see if it will produce a valid file.

diff --git a/youtube_dl/downloader/hls.py b/youtube_dl/downloader/hls.py
index b59aad73f..a7b060fd8 100644
--- a/youtube_dl/downloader/hls.py
+++ b/youtube_dl/downloader/hls.py
@@ -13,6 +13,7 @@ from .external import FFmpegFD
 
 from ..compat import (
     compat_urllib_error,
+    compat_urllib_parse_unquote,
     compat_urlparse,
     compat_struct_pack,
 )
@@ -184,6 +185,7 @@ class HlsFD(FragmentFD):
                     if decrypt_info['METHOD'] == 'AES-128':
                         if 'IV' in decrypt_info:
                             decrypt_info['IV'] = binascii.unhexlify(decrypt_info['IV'][2:].zfill(32))
+                        decrypt_info['URI'] = compat_urllib_parse_unquote(decrypt_info['URI'])
                         if not re.match(r'^https?://', decrypt_info['URI']):
                             decrypt_info['URI'] = compat_urlparse.urljoin(
                                 man_url, decrypt_info['URI'])

make sure that you use the Native HLS Downloader:

youtube-dl --hls-prefer-native [M3U8_URL]
@remitamine commented on GitHub (Jul 17, 2019): the manifests served from this website are (partially) encode parts of the Key URL. you can try to use this patch to correct the key URL and see if it will produce a valid file. ```diff diff --git a/youtube_dl/downloader/hls.py b/youtube_dl/downloader/hls.py index b59aad73f..a7b060fd8 100644 --- a/youtube_dl/downloader/hls.py +++ b/youtube_dl/downloader/hls.py @@ -13,6 +13,7 @@ from .external import FFmpegFD from ..compat import ( compat_urllib_error, + compat_urllib_parse_unquote, compat_urlparse, compat_struct_pack, ) @@ -184,6 +185,7 @@ class HlsFD(FragmentFD): if decrypt_info['METHOD'] == 'AES-128': if 'IV' in decrypt_info: decrypt_info['IV'] = binascii.unhexlify(decrypt_info['IV'][2:].zfill(32)) + decrypt_info['URI'] = compat_urllib_parse_unquote(decrypt_info['URI']) if not re.match(r'^https?://', decrypt_info['URI']): decrypt_info['URI'] = compat_urlparse.urljoin( man_url, decrypt_info['URI']) ``` make sure that you use the Native HLS Downloader: ``` youtube-dl --hls-prefer-native [M3U8_URL] ```
Author
Owner

@singhal-shagun commented on GitHub (Jul 17, 2019):

Which file should I put this code in? Would I need to recompile things? I'm somewhat lost...

@singhal-shagun commented on GitHub (Jul 17, 2019): Which file should I put this code in? Would I need to recompile things? I'm somewhat lost...
Author
Owner

@remitamine commented on GitHub (Jul 17, 2019):

you can look up online for how to obtain source code from a git repository, apply a git patch and running the source code with python.

@remitamine commented on GitHub (Jul 17, 2019): you can look up online for how to obtain source code from a git repository, apply a git patch and running the source code with python.
Author
Owner

@singhal-shagun commented on GitHub (Jul 17, 2019):

@remitamine
Although it took me an entire night to understand your approach, but I'm still up against a roadblock..

First, kindly confirm whether the steps I performed are correct:

  1. Install Git for Windows, Visual Studio Code, GNU Make, Python, Pandoc & Nostests.
  2. Fork Youtube-dl's repository to my github account and then clone it on my local machine.
  3. In the clone downloaded on my machine, in the hls.py file, insert those two statements.
  4. Then run the command python -m youtube_dl --hls-prefer-native [m3u8 URL] to see if the issue is solved.

If the above understanding is correct, then please check the associated logs. I'm still getting an error...though, it's different from the earlier one.

Also, the command I mentioned in step 4 above doesn't seem to be using the HLS downloader. Youtube-DL is using FFMPEG, which might be the cause of the issue now. Possibly, I'm framing the command in an incorrect manner?
Logs.log

@singhal-shagun commented on GitHub (Jul 17, 2019): @remitamine Although it took me an entire night to understand your approach, but I'm still up against a roadblock.. First, kindly confirm whether the steps I performed are correct: 1. Install Git for Windows, Visual Studio Code, GNU Make, Python, Pandoc & Nostests. 2. Fork Youtube-dl's repository to my github account and then clone it on my local machine. 3. In the clone downloaded on my machine, in the hls.py file, insert those two statements. 4. Then run the command `python -m youtube_dl --hls-prefer-native [m3u8 URL]` to see if the issue is solved. If the above understanding is correct, then please check the associated logs. I'm still getting an error...though, it's different from the earlier one. Also, the command I mentioned in step 4 above doesn't seem to be using the HLS downloader. Youtube-DL is using FFMPEG, which might be the cause of the issue now. Possibly, I'm framing the command in an incorrect manner? [Logs.log](https://github.com/ytdl-org/youtube-dl/files/3404127/Logs.log)
Author
Owner

@remitamine commented on GitHub (Jul 17, 2019):

the command I mentioned in step 4 above doesn't seem to be using the HLS downloader

install PyCrypto or PyCryptodome.

@remitamine commented on GitHub (Jul 17, 2019): > the command I mentioned in step 4 above doesn't seem to be using the HLS downloader install PyCrypto or PyCryptodome.
Author
Owner

@singhal-shagun commented on GitHub (Jul 19, 2019):

Hi @remitamine,

I installed PyCrypto and downloaded two of those videos. However, I face the following issues:

  1. The video downloads were interrupted multiple times with the error, ERROR: Did not get any data blocks.
  2. When I got this error, I would re-run the command and the video download would resume. Although I could download the complete videos by resuming the operation 3-4 times, with the 1st video, I got the message Malformed aac bitstream detected. Install ffmpeg or avconv to fix this automatically. Also, the video couldn't be played either by VLC or by PotPlayer.
  3. So when I tried downloading the 2nd video, I placed ffpmeg.exe file in youtube-dl folder (where setup.py is present in the cloned code). Although I didn't get the malfomed aac bitstream message this time, but the downloaded video still couldn't be viewed using VLC or PotPlayer.

In the file properties, Windows has mostly blank fields.
image
image
image
image

VLC doesn't even show the duration of the video:
image
image
image

Any ideas what's going wrong here?

For the malformed aac bitstream, I tried the suggestions on this reddit thread but they didn't work. If it doesn't cause us to deviate from the thread title, your ideas on that too would be invaluable.

@singhal-shagun commented on GitHub (Jul 19, 2019): Hi @remitamine, I installed PyCrypto and downloaded two of those videos. However, I face the following issues: 1. The video downloads were interrupted multiple times with the error, `ERROR: Did not get any data blocks`. 2. When I got this error, I would re-run the command and the video download would resume. Although I could download the complete videos by resuming the operation 3-4 times, with the 1st video, I got the message `Malformed aac bitstream detected. Install ffmpeg or avconv to fix this automatically`. Also, the video couldn't be played either by VLC or by PotPlayer. 3. So when I tried downloading the 2nd video, I placed ffpmeg.exe file in youtube-dl folder (where setup.py is present in the cloned code). Although I didn't get the malfomed aac bitstream message this time, but the downloaded video still couldn't be viewed using VLC or PotPlayer. In the file properties, Windows has mostly blank fields. ![image](https://user-images.githubusercontent.com/20037489/61538642-74cd5080-aa57-11e9-8b43-bd566a513182.png) ![image](https://user-images.githubusercontent.com/20037489/61538695-93334c00-aa57-11e9-83ad-8b5541486a3e.png) ![image](https://user-images.githubusercontent.com/20037489/61538736-ae9e5700-aa57-11e9-9243-419e9bf7c00d.png) ![image](https://user-images.githubusercontent.com/20037489/61538764-b78f2880-aa57-11e9-81f5-315d2fb51f54.png) VLC doesn't even show the duration of the video: ![image](https://user-images.githubusercontent.com/20037489/61538884-eefdd500-aa57-11e9-8856-8dba41a67002.png) ![image](https://user-images.githubusercontent.com/20037489/61539011-28cedb80-aa58-11e9-8f28-e3fab8159c9f.png) ![image](https://user-images.githubusercontent.com/20037489/61539062-400dc900-aa58-11e9-8fb5-ff84c0168033.png) Any ideas what's going wrong here? For the malformed aac bitstream, I tried the suggestions on [this reddit thread](https://www.reddit.com/r/ffmpeg/comments/6zixt6/fixing_malformed_aac_bitstream/) but they didn't work. If it doesn't cause us to deviate from the thread title, your ideas on that too would be invaluable.
Author
Owner

@singhal-shagun commented on GitHub (Jul 20, 2019):

@remitamine
Some thing strange happended after I created a local EXE of youtube-dl as per your advice here. I put the EXE in a folder with the other FFMPEG files (ffmpeg.exe, ffplay.exe, ffprobe.exe). And then, I ran this batch file:
ExecuteTillDownloaded(Successful).zip

The result was:
Log.txt

The following caught my eye:

  1. It threw the warning: "WARNING: hlsnative has detected features it does not support, extraction will be delegated to ffmpeg". But even till yesterday, hls downloader supported the download....including our modified source code.
  2. The ffmpeg continued downloading later fragments even though it failed to download many fragments in between.
  3. Although it says "[download] 100% of 120.16MiB in 02:44:15", the fact is that the downloaded file is only 35 minutes 18 seconds long; not 2 hours 44 minutes 15 seconds long as it should be.
  4. Every second of this 35 minutes 18 seconds works, in contrast to the earlier HLS downloads which didn't work, despite being complete downloads.

Any advice? Would we be able to make HLS downloader work as earlier, and have the ffmpeg files in the same folder to allow youtube-dl to fix the malformed bitstream?

@singhal-shagun commented on GitHub (Jul 20, 2019): @remitamine Some thing strange happended after I created a local EXE of youtube-dl as per your advice [here](https://github.com/ytdl-org/youtube-dl/issues/21825). I put the EXE in a folder with the other FFMPEG files (ffmpeg.exe, ffplay.exe, ffprobe.exe). And then, I ran this batch file: [ExecuteTillDownloaded(Successful).zip](https://github.com/ytdl-org/youtube-dl/files/3413295/ExecuteTillDownloaded.Successful.zip) The result was: [Log.txt](https://github.com/ytdl-org/youtube-dl/files/3413288/Log.txt) The following caught my eye: 1. It threw the warning: "WARNING: hlsnative has detected features it does not support, extraction will be delegated to ffmpeg". But even till yesterday, hls downloader supported the download....including our modified source code. 2. The ffmpeg continued downloading later fragments even though it failed to download many fragments in between. 3. Although it says "[download] 100% of 120.16MiB in 02:44:15", the fact is that the downloaded file is only 35 minutes 18 seconds long; not 2 hours 44 minutes 15 seconds long as it should be. 4. Every second of this 35 minutes 18 seconds works, in contrast to the earlier HLS downloads which didn't work, despite being complete downloads. Any advice? Would we be able to make HLS downloader work as earlier, and have the ffmpeg files in the same folder to allow youtube-dl to fix the malformed bitstream?
Author
Owner

@remitamine commented on GitHub (Jul 20, 2019):

It threw the warning: "WARNING: hlsnative has detected features it does not support, extraction will be delegated to ffmpeg". But even till yesterday, hls downloader supported the download....including our modified source code.

PyCrypto missing from executable

The ffmpeg continued downloading later fragments even though it failed to download many fragments in between.

possibly similar to #15914.

anyway, you have to look for a solution for the problem you have, I'm not here to fix every problem and answer every question(especially when the problem is caused by the website serving partially broken files)

@remitamine commented on GitHub (Jul 20, 2019): > It threw the warning: "WARNING: hlsnative has detected features it does not support, extraction will be delegated to ffmpeg". But even till yesterday, hls downloader supported the download....including our modified source code. PyCrypto missing from executable > The ffmpeg continued downloading later fragments even though it failed to download many fragments in between. possibly similar to #15914. anyway, you have to look for a solution for the problem you have, I'm not here to fix every problem and answer every question(especially when the problem is caused by the website serving partially broken files)
Author
Owner

@singhal-shagun commented on GitHub (Jul 21, 2019):

@remitamine
The file that I'm downloading using HLS downloader is remaining encrypted. That's why I'm unable to view the video, despite being able to download the videos completely.

Any suggestions regarding the code to write the output file in decrypted form?

@singhal-shagun commented on GitHub (Jul 21, 2019): @remitamine The file that I'm downloading using HLS downloader is remaining encrypted. That's why I'm unable to view the video, despite being able to download the videos completely. Any suggestions regarding the code to write the output file in decrypted form?
Author
Owner

@remitamine commented on GitHub (Jul 21, 2019):

Any suggestions regarding the code to write the output file in decrypted form?

you have to fix the way to obtain the AES key.

and again, I'm not highly interested in this issue.

@remitamine commented on GitHub (Jul 21, 2019): > Any suggestions regarding the code to write the output file in decrypted form? you have to fix the way to obtain the AES key. and again, I'm **not highly** interested in this issue.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/youtube-dl-ytdl-org#17420
No description provided.