|
Thread
-
Hello, rookie here,
I manually download the .mpd file using yt-dlp, best-video.mp4, and best-audio.m4a
Then I decrypt them using mp4decrypt
Lastly, I join them using ffmpeg
Is there any way to do all these things automatically?
So that when I put the .mpd url and decryption key the remaining steps get completed automatically and produce the final output video.
-
See https://forum.videohelp.com/threads/407216-Decryption-The-Dungeon-of-Despair especially the second post for examples. A few other users here are posing scripts too. Look at them and adapt to your own needs
-
Search, Learn, Download!
Originally Posted by Jelov
Hello, rookie here,
I manually download the .mpd file using yt-dlp, best-video.mp4, and best-audio.m4a
Then I decrypt them using mp4decrypt
Lastly, I join them using ffmpeg
Is there any way to do all these things automatically?
So that when I put the .mpd url and decryption key the remaining steps get completed automatically and produce the final output video.
If you insist on using yt-dlp then I'm not sure, but N_m3u8DL-RE does all that (when using the needed parameters)
-
Originally Posted by Karoolus
If you insist on using yt-dlp then I'm not sure, but N_m3u8DL-RE does all that (when using the needed parameters)
Okay I'm ready to adapt to new things. Kindly tell me the procedure I will try that out.
-
Search, Learn, Download!
Originally Posted by Jelov
Originally Posted by Karoolus
If you insist on using yt-dlp then I'm not sure, but N_m3u8DL-RE does all that (when using the needed parameters)
Okay I'm ready to adapt to new things. Kindly tell me the procedure I will try that out.
https://github.com/nilaoda/N_m3u8DL-RE
-
Originally Posted by Karoolus
Thank you so much brother N_m3u8DL-RE has saved me a lot of effort. Really appreciate
-
I did compose this python script yonks ago. It's fairly generic: but it automatically does what you do. You run it. It asks for mpd. It'll download bestvideo & bestaudio using yt-dlp (of course, it does not select if best audio has AD, etc.), it'll ask for KEY#. Then it decrypts. It asks what name do you want to give file (yes, you can include spaces). then it'll place the decrypted file in a folder called Completed within the same folder that your python file resides:
Code:
####version (20230205-1) do checks for dupe filename and illegal characters
####version (20230129-1) replace aria2c with -N 6
####version (20221117-1)
#### remove y/n option to remove crap (it auto removes it now)
#### use shutil for moving crap to ./Throwaway and for removing ./Throwaway and its contents
#### allow you to call final file name to include spaces
#### at the end, it will now delete the Throwaway folder
import os
import shutil
import glob
##########useful when used within VS Code to tell it which directory you're in
abspath = os.path.abspath(__file__)
dname = os.path.dirname(abspath)
os.chdir(dname)
##########
def cls():
# posix is os name for Linux or mac
if(os.name == 'posix'):
os.system('clear') # clear is the bash command
# else screen will be cleared for windows (os name is actually nt for Windows)
else:
os.system('cls') # cls is the batch command
def filename():
output_name = input("What do you want to call your final file? (do not include file .extension like .mp4) ")
output_name = f"{output_name}.mp4"
path = f"./Completed/{output_name}"
# look to see if duplicate filename
if os.path.isfile(path):
print(f"\nyou already have a file called {output_name}. Choose another name\n")
return filename()
#look to see if any illegal characters in filename
illegals = "@$%\/:*?\"<>|~`#^+=\{\};!"
any_illegals = (set(output_name) & set(illegals))
if not any_illegals:
return output_name
else:
list_illegals = ' '.join(any_illegals)
print(f"\nyou have included the following which are not legal characters: {list_illegals}\n")
return filename()
os.system('cls')
print("\n\n")
mpd_url = input("what is mpd URL? ")
os.system(f'yt-dlp --allow-u -f bestvideo -N 6 "{mpd_url}" -o encryptVid.mp4')
os.system(f'yt-dlp --allow-u -f bestaudio -N 6 "{mpd_url}" -o encryptAud.m4a')
key = input("\n\nwhat is the KEY? ")
print("==============================\n\n Decrypting\n\n==============================")
os.system(f"mp4decrypt --show-progress --key 1:{key} encryptVid.mp4 video_decrypt.mp4")
os.system(f"mp4decrypt --show-progress --key 1:{key} encryptAud.m4a audio_decrypt.m4a")
if not os.path.exists("Throwaway"):
os.makedirs("Throwaway")
if not os.path.exists("Completed"):
os.makedirs("Completed")
print("\n\n\n\n")
output_name = filename()
os.system(f"ffmpeg -i video_decrypt.mp4 -i audio_decrypt.m4a -c:v copy -c:a copy mux_file.mp4")
os.rename("mux_file.mp4", f'{output_name}')
shutil.move(f'{output_name}', "./Completed")
for data in glob.glob("*_decrypt*.*"):
shutil.move(data,"./Throwaway")
for data in glob.glob("encrypt*.*"):
shutil.move(data,"./Throwaway")
shutil.rmtree("./Throwaway")
print(f"All done.\n\n Your final file '{output_name}' is in 'Completed' folder")
-
Originally Posted by deccavox
I did compose this python script yonks ago. It's fairly generic: but it automatically does what you do. You run it. It asks for mpd. It'll download bestvideo & bestaudio using yt-dlp (of course, it does not select if best audio has AD, etc.), it'll ask for KEY#. Then it decrypts. It asks what name do you want to give file (yes, you can include spaces). then it'll place the decrypted file in a folder called Completed within the same folder that your python file resides:
Code:
####version (20230205-1) do checks for dupe filename and illegal characters
####version (20230129-1) replace aria2c with -N 6
####version (20221117-1)
#### remove y/n option to remove crap (it auto removes it now)
#### use shutil for moving crap to ./Throwaway and for removing ./Throwaway and its contents
#### allow you to call final file name to include spaces
#### at the end, it will now delete the Throwaway folder
import os
import shutil
import glob
##########useful when used within VS Code to tell it which directory you're in
abspath = os.path.abspath(__file__)
dname = os.path.dirname(abspath)
os.chdir(dname)
##########
def cls():
# posix is os name for Linux or mac
if(os.name == 'posix'):
os.system('clear') # clear is the bash command
# else screen will be cleared for windows (os name is actually nt for Windows)
else:
os.system('cls') # cls is the batch command
def filename():
output_name = input("What do you want to call your final file? (do not include file .extension like .mp4) ")
output_name = f"{output_name}.mp4"
path = f"./Completed/{output_name}"
# look to see if duplicate filename
if os.path.isfile(path):
print(f"\nyou already have a file called {output_name}. Choose another name\n")
return filename()
#look to see if any illegal characters in filename
illegals = "@$%\/:*?\"<>|~`#^+=\{\};!"
any_illegals = (set(output_name) & set(illegals))
if not any_illegals:
return output_name
else:
list_illegals = ' '.join(any_illegals)
print(f"\nyou have included the following which are not legal characters: {list_illegals}\n")
return filename()
os.system('cls')
print("\n\n")
mpd_url = input("what is mpd URL? ")
os.system(f'yt-dlp --allow-u -f bestvideo -N 6 "{mpd_url}" -o encryptVid.mp4')
os.system(f'yt-dlp --allow-u -f bestaudio -N 6 "{mpd_url}" -o encryptAud.m4a')
key = input("\n\nwhat is the KEY? ")
print("==============================\n\n Decrypting\n\n==============================")
os.system(f"mp4decrypt --show-progress --key 1:{key} encryptVid.mp4 video_decrypt.mp4")
os.system(f"mp4decrypt --show-progress --key 1:{key} encryptAud.m4a audio_decrypt.m4a")
if not os.path.exists("Throwaway"):
os.makedirs("Throwaway")
if not os.path.exists("Completed"):
os.makedirs("Completed")
print("\n\n\n\n")
output_name = filename()
os.system(f"ffmpeg -i video_decrypt.mp4 -i audio_decrypt.m4a -c:v copy -c:a copy mux_file.mp4")
os.rename("mux_file.mp4", f'{output_name}')
shutil.move(f'{output_name}', "./Completed")
for data in glob.glob("*_decrypt*.*"):
shutil.move(data,"./Throwaway")
for data in glob.glob("encrypt*.*"):
shutil.move(data,"./Throwaway")
shutil.rmtree("./Throwaway")
print(f"All done.\n\n Your final file '{output_name}' is in 'Completed' folder")
thanks for the script
instead of using "mp4decrypt and ffmpeg" can u switch it to "mkvmerge and shaka-packager"
-
Originally Posted by deccavox
I did compose this python script yonks ago. It's fairly generic: but it automatically does what you do. You run it. It asks for mpd. It'll download bestvideo & bestaudio using yt-dlp (of course, it does not select if best audio has AD, etc.), it'll ask for KEY#. Then it decrypts. It asks what name do you want to give file (yes, you can include spaces). then it'll place the decrypted file in a folder called Completed within the same folder that your python file resides:
Code:
####version (20230205-1) do checks for dupe filename and illegal characters
####version (20230129-1) replace aria2c with -N 6
####version (20221117-1)
#### remove y/n option to remove crap (it auto removes it now)
#### use shutil for moving crap to ./Throwaway and for removing ./Throwaway and its contents
#### allow you to call final file name to include spaces
#### at the end, it will now delete the Throwaway folder
import os
import shutil
import glob
##########useful when used within VS Code to tell it which directory you're in
abspath = os.path.abspath(__file__)
dname = os.path.dirname(abspath)
os.chdir(dname)
##########
def cls():
# posix is os name for Linux or mac
if(os.name == 'posix'):
os.system('clear') # clear is the bash command
# else screen will be cleared for windows (os name is actually nt for Windows)
else:
os.system('cls') # cls is the batch command
def filename():
output_name = input("What do you want to call your final file? (do not include file .extension like .mp4) ")
output_name = f"{output_name}.mp4"
path = f"./Completed/{output_name}"
# look to see if duplicate filename
if os.path.isfile(path):
print(f"\nyou already have a file called {output_name}. Choose another name\n")
return filename()
#look to see if any illegal characters in filename
illegals = "@$%\/:*?\"<>|~`#^+=\{\};!"
any_illegals = (set(output_name) & set(illegals))
if not any_illegals:
return output_name
else:
list_illegals = ' '.join(any_illegals)
print(f"\nyou have included the following which are not legal characters: {list_illegals}\n")
return filename()
os.system('cls')
print("\n\n")
mpd_url = input("what is mpd URL? ")
os.system(f'yt-dlp --allow-u -f bestvideo -N 6 "{mpd_url}" -o encryptVid.mp4')
os.system(f'yt-dlp --allow-u -f bestaudio -N 6 "{mpd_url}" -o encryptAud.m4a')
key = input("\n\nwhat is the KEY? ")
print("==============================\n\n Decrypting\n\n==============================")
os.system(f"mp4decrypt --show-progress --key 1:{key} encryptVid.mp4 video_decrypt.mp4")
os.system(f"mp4decrypt --show-progress --key 1:{key} encryptAud.m4a audio_decrypt.m4a")
if not os.path.exists("Throwaway"):
os.makedirs("Throwaway")
if not os.path.exists("Completed"):
os.makedirs("Completed")
print("\n\n\n\n")
output_name = filename()
os.system(f"ffmpeg -i video_decrypt.mp4 -i audio_decrypt.m4a -c:v copy -c:a copy mux_file.mp4")
os.rename("mux_file.mp4", f'{output_name}')
shutil.move(f'{output_name}', "./Completed")
for data in glob.glob("*_decrypt*.*"):
shutil.move(data,"./Throwaway")
for data in glob.glob("encrypt*.*"):
shutil.move(data,"./Throwaway")
shutil.rmtree("./Throwaway")
print(f"All done.\n\n Your final file '{output_name}' is in 'Completed' folder")
Can u add upload to googledrive option which will use token pickle and after its uploaded it'll print the gdrive url
Similar Threads
-
By lfybbk10 in forum Video Streaming Downloading
Replies: 38
Last Post: 20th Feb 2025, 06:46
-
By pratikpatel8982 in forum Video Streaming Downloading
Replies: 15
Last Post: 1st Dec 2024, 15:26
-
By Av4K100 in forum Video Streaming Downloading
Replies: 5
Last Post: 1st Feb 2023, 15:56
-
By dzigelbaum in forum Video Streaming Downloading
Replies: 5
Last Post: 26th Mar 2022, 01:23
-
By SoConfused in forum Video Streaming Downloading
Replies: 1
Last Post: 14th Jun 2021, 16:21
|