anijackich / kinescope-dl

Command-line program to download videos from Kinescope.io
The Unlicense
125 stars 15 forks source link

mp4decrypt binary was not found at the specified path #7

Closed frenzymind closed 1 year ago

frenzymind commented 1 year ago

run this command:

python3 kinescope-dl.py -r https://referer_site --best-quality https://kinescope.io/203976684 test.mp4

I also have ffmpeg, ggprobe, mp4decrypt files on this same level with kinescope-dl.py file:

root@ndev:/home/kinescope-dl# ls -la
total 80543
drwxr-xr-x  7 root root       14 Jul 20 00:23 .
drwxr-xr-x 34 root root       37 Jul 19 22:44 ..
drwxr-xr-x  7 root root        7 Jul 19 22:48 bento
-rwxrwxrwx  1 root root 78683840 Mar 12 23:52 ffmpeg
drwxr-xr-x  4 root root        9 Jul 19 22:47 ffmpegbin
-rwxrwxrwx  1 root root 78557440 Mar 12 23:52 ffprobe
drwxr-xr-x  8 root root       13 Jul 19 22:44 .git
-rw-r--r--  1 root root       93 Jul 19 22:44 .gitignore
drwxr-xr-x  3 root root        8 Jul 19 22:46 kinescope
-rwxr-xr-x  1 root root     2441 Jul 19 22:44 kinescope-dl.py
-rwxrwxrwx  1 root root  1018392 May 20 01:42 mp4decrypt
-rw-r--r--  1 root root     1915 Jul 19 22:44 README.md
-rw-r--r--  1 root root       58 Jul 19 22:44 requirements.txt
drwxr-xr-x  2 root root        2 Jul 20 00:47 temp

but I got this error:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~                KINESCOPE-DL                ~
~         Kinescope videos downloader        ~
~ https://github.com/anijackich/kinescope-dl ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

= DOWNLOADING =================
Video: 100%|██████████| [1/1]
Audio: 100%|██████████| [1/1]
[*] Decrypting... Traceback (most recent call last):
  File "/home/kinescope-dl/kinescope/downloader.py", line 58, in _decrypt_video
    Popen(f"{self.mp4decrypt_path if self.mp4decrypt_path else 'mp4decrypt'} "
  File "/usr/lib/python3.9/subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.9/subprocess.py", line 1823, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'mp4decrypt --key 1:6b734e6945736e583570644d3544773d "temp/277ead141c634596abbc2952a1e6fbe2_video.mp4.enc" "temp/277ead141c634596abbc2952a1e6fbe2_video.mp4"'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/kinescope-dl/kinescope-dl.py", line 73, in <module>
    main()
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/home/kinescope-dl/kinescope-dl.py", line 64, in main
    downloader.download(
  File "/home/kinescope-dl/kinescope/downloader.py", line 156, in download
    self._decrypt_video(
  File "/home/kinescope-dl/kinescope/downloader.py", line 63, in _decrypt_video
    raise FFmpegNotFoundError('mp4decrypt binary was not found at the specified path')
kinescope.exceptions.FFmpegNotFoundError: mp4decrypt binary was not found at the specified path

I also tried this one:

python3 kinescope-dl.py -r https://referer_site --best-quality --ffmpeg-bin ./ffmpegbin/ --mp4decrypt-bin ./bento/bin/mp4decrypt  https://kinescope.io/203976684 test.mp4

What I do wrong ? I saw your activity here, I think you should know the solution, sorry if not @ic-it

ic-it commented 1 year ago

Try explicitly specifying where mp4decrypt is located. I see that you did this in your second try, but I also see that mp4decrypt is in ./mp4decrypt and not ./bento/bin/mp4decrypt (based on your ls -la).

frenzymind commented 1 year ago

I see that you did this in your second try, but I also see that mp4decrypt is in ./mp4decrypt and not ./bento/bin/mp4decrypt

./mp4decrypt this is binary file it self, the same for ./ffmpeg So I expect this files to be used by default. In my second try I use folders where binaries are located. But both don't work

frenzymind commented 1 year ago

in downloader.py I add shell=True in Popen functions that call ffmpeg and mp4decrypt. And I have to specify --ffmpeg-bin and --mp4decrypt-bin. Then it works perfect!

Popen(f"{self.ffmpeg_path if self.ffmpeg_path else 'ffmpeg'} "
                  f"-i {source_video_filepath} "
                  f"-i {source_audio_filepath} "
                  f"-c copy {target_filepath} "
                  f"-y -loglevel error", shell=True).communicate()

Popen(f"{self.mp4decrypt_path if self.mp4decrypt_path else 'mp4decrypt'} "
                f"--key 1:{key} "
                f"\"{source_filepath}\" "
                f"\"{target_filepath}\"", shell=True).communicate()
python3 kinescope-dl.py --best-quality --ffmpeg-bin ./ffmpeg --mp4decrypt-bin ./mp4decrypt video_id