Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Decrypted video lessons with size 250 to 300 bytes #256

Open
oijm17 opened this issue Nov 23, 2024 · 5 comments
Open

[Bug]: Decrypted video lessons with size 250 to 300 bytes #256

oijm17 opened this issue Nov 23, 2024 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@oijm17
Copy link

oijm17 commented Nov 23, 2024

What happened?

Decrypted video lessons with size 250 to 300 bytes

Since the latest changes made to the script (a couple of months ago), I only get corrupted video files, with ridiculous size. If we talk only about this specific problem, the previous version of the script did not present this serious problem.

Expected Result

The script should download, decrypt and multiplex the playable video files for each of the lessons.

Branch

master/main

What operating systems are you seeing the problem on?

Linux/Unix, MacOS

Relevant log output

[02:25:33] [udemy-downloader] [parse_new:1632] INFO:   > Processing lecture 05 of 371
[02:25:33] [udemy-downloader] [process_lecture:1448] INFO:       > Lecture '05 Test' has DRM, attempting to download
[02:25:33] [udemy-downloader] [handle_segments:1211] INFO: > Downloading Lecture Tracks...
WARNING: You have asked for UNPLAYABLE formats to be listed/downloaded. This is a developer option intended for debugging. 
         If you experience any issues while using this option, DO NOT open a bug report
[generic] Extracting URL: file:///root/udemy-downloader/temp/index_42618910.mpd
[generic] index_42618910: Downloading webpage
WARNING: [generic] Forcing generic information extractor
[generic] index_42618910: Extracting information
[info] index_42618910: Downloading 2 format(s): 5, 6
[dashsegments] Total fragments: 4
[download] Destination: 33187966.encrypted.mp4
[download] 100% of  282.15KiB in 00:00:00 at 3.29MiB/s
[dashsegments] Total fragments: 20
[download] Destination: 33187966.encrypted.m4a
[download] 100% of  692.11KiB in 00:00:00 at 3.01MiB/s
[02:25:34] [udemy-downloader] [handle_segments:1236] INFO: > Lecture Tracks Downloaded
[02:25:34] [udemy-downloader] [handle_segments:1247] INFO: KID for video file is: 46e4d88a2ce54c34b86261ca5419015d
[02:25:34] [udemy-downloader] [handle_segments:1254] INFO: KID for audio file is: 46e4d88a2ce54c34b86261ca5419015d
[02:25:34] [udemy-downloader] [handle_segments:1293] INFO: > Merging video and audio, this might take a minute...
ffmpeg version 4.2.10 Copyright (c) 2000-2024 the FFmpeg developers
  built with gcc 8 (GCC)
  configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --docdir=/usr/share/doc/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection' --extra-ldflags='-Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld ' --extra-cflags=' ' --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-version3 --enable-bzlib --disable-crystalhd --enable-fontconfig --enable-frei0r --enable-gcrypt --enable-gnutls --enable-ladspa --enable-libaom --enable-libdav1d --enable-libass --enable-libbluray --enable-libcdio --enable-libdrm --enable-libjack --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libmp3lame --enable-nvenc --enable-openal --enable-opencl --enable-opengl --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librsvg --enable-libsrt --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-version3 --enable-vapoursynth --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzimg --enable-libzvbi --enable-avfilter --enable-avresample --enable-libmodplug --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-libmfx --enable-runtime-cpudetect
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x55704647a900] Incorrect number of samples in encryption info
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x55704647a900] Could not find codec parameters for stream 0 (Video: h264 (avc1 / 0x31637661), none, 1920x1080, 131 kb/s): unspecified pixel format
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '33187966.encrypted.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 1
    compatible_brands: isomavc1dash
    creation_time   : 2024-11-23T04:47:14.000000Z
  Duration: 00:00:16.38, bitrate: 141 kb/s
    Stream #0:0(und): Video: h264 (avc1 / 0x31637661), none, 1920x1080, 131 kb/s, SAR 1:1 DAR 16:9, 30 fps, 30k tbr, 30k tbn, 60k tbc (default)
    Metadata:
      creation_time   : 2024-11-23T04:47:14.000000Z
      handler_name    : ETI ISO Video Media Handler
      encoder         : Elemental H.264
    Side data:
      unknown side data type 24 (3247 bytes)
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5570464e3780] Found duplicated MOOV Atom. Skipped it
    Last message repeated 3 times
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5570464e3780] Incorrect number of samples in encryption info
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from '33187966.encrypted.m4a':
  Metadata:
    major_brand     : isom
    minor_version   : 1
    compatible_brands: isomavc1dash
    creation_time   : 2024-11-23T04:47:15.000000Z
  Duration: 00:00:16.39, bitrate: 345 kb/s
    Stream #1:0(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 313 kb/s (default)
    Metadata:
      creation_time   : 2024-11-23T04:47:15.000000Z
      handler_name    : ETI ISO Audio Media Handler
    Side data:
      unknown side data type 24 (16219 bytes)
[mp4 @ 0x5570465fe740] track 1: codec frame size is not set
Output #0, mp4, to '/root/udemy-downloader/out_dir/COURSE_NAME/01 - Pandas with DataFrames/33187966.mp4':
  Metadata:
    title           : 05 Test
    Stream #0:0: Video: h264 (avc1 / 0x31637661), none, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 131 kb/s, 30 fps, 30k tbr, 30k tbn, 30k tbc (default)
    Side data:
      unknown side data type 24 (3247 bytes)
    Stream #0:1: Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 313 kb/s (default)
    Side data:
      unknown side data type 24 (16219 bytes)
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #1:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5570464e3780] Incorrect number of samples in encryption info
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x55704647a900] Incorrect number of samples in encryption info
33187966.encrypted.mp4: Invalid data found when processing input
frame=    0 fps=0.0 q=-1.0 Lsize=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
[02:25:34] [udemy-downloader] [handle_segments:1298] INFO: > Merging complete, renaming final file...
[02:25:34] [udemy-downloader] [handle_segments:1300] INFO: > Cleaning up temporary files...
...

Other information

I'm using:

  • Python v3.11
  • Lastest versión of yt-dlp
@oijm17 oijm17 added the bug Something isn't working label Nov 23, 2024
@celikemir
Copy link

celikemir commented Dec 7, 2024

I’m experiencing the same issue, and it’s quite frustrating. Although the first lecture downloaded successfully, the others are unusually small in size and unplayable. As far as I know, the DRM is configured correctly.

@celikemir
Copy link

celikemir commented Dec 7, 2024

Hey, I realized that this issue was related to the Docker container. I was running the repository within a Docker container on an M Silicon MacBook. I created a virtual environment from scratch, installed shaka-packager, and linked the virtual environment, so it works now.
Be careful after installing shaka-packager because the installed package name is packager under /usr/local/bin. You should rename it to shaka-packager under your virtual environment.

@anthelinux
Copy link

@celikemir I also run the script in docker and have the same issue where encrypted files have a small size, but the DRM config is okay. What did you do with shaka-packager exactly ? you added it to your docker compose ?

@Puyodead1
Copy link
Owner

The latest version of the script doesn't use shaka-packager for decryption anymore and uses FFmpeg instead, you need version 5 or higher. That might be the issue with docker

@anthelinux
Copy link

anthelinux commented Dec 11, 2024

@Puyodead1 You were right, I modified the dockerfile to force the latest ffmpeg version, rerun the script and the video files were well decrypted and I could play them.

Here's the updated dockerfile I made :

# Use an official Python runtime as a parent image
FROM python:3.12-slim-bullseye

# Set the working directory in the container to /app
WORKDIR /app

# Install necessary packages
RUN apt-get update && apt-get install -y \
    curl \
    wget \
    aria2 \
    unzip \
    xz-utils \
    && rm -rf /var/lib/apt/lists/*

# Install FFmpeg from johnvansickle's builds (always latest stable version)
RUN wget https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz \
    && tar xvf ffmpeg-release-amd64-static.tar.xz \
    && mv ffmpeg-*-amd64-static/ffmpeg /usr/local/bin/ \
    && mv ffmpeg-*-amd64-static/ffprobe /usr/local/bin/ \
    && rm -rf ffmpeg-*-amd64-static* \
    && chmod +x /usr/local/bin/ffmpeg \
    && chmod +x /usr/local/bin/ffprobe

# Install Shaka Packager
RUN wget https://github.com/shaka-project/shaka-packager/releases/download/v3.2.0/packager-linux-x64 -O /usr/local/bin/shaka-packager
RUN chmod +x /usr/local/bin/shaka-packager

# Copy the current directory contents into the container at /app
COPY . /app

# Install Python application dependencies
RUN pip install -r requirements.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants