+ Reply to Thread
Results 1 to 9 of 9
Thread
  1. 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.
    Quote Quote  
  2. Member
    Join Date: Feb 2022
    Location: Search the forum first!
    Search PM
    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
    Quote Quote  
  3. Search, Learn, Download! Karoolus's Avatar
    Join Date: Oct 2022
    Location: Belgium
    Search Comp PM
    Originally Posted by Jelov View Post
    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)
    Quote Quote  
  4. Originally Posted by Karoolus View Post
    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.
    Quote Quote  
  5. Search, Learn, Download! Karoolus's Avatar
    Join Date: Oct 2022
    Location: Belgium
    Search Comp PM
    Originally Posted by Jelov View Post
    Originally Posted by Karoolus View Post
    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
    Quote Quote  
  6. Originally Posted by Karoolus View Post
    Thank you so much brother N_m3u8DL-RE has saved me a lot of effort. Really appreciate
    Quote Quote  
  7. Member
    Join Date: Dec 2021
    Location: Scotland
    Search Comp PM
    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")
    Quote Quote  
  8. Originally Posted by deccavox View Post
    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"
    Quote Quote  
  9. Member
    Join Date: Jun 2023
    Location: Hamriya
    Search Comp PM
    Originally Posted by deccavox View Post
    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
    Quote Quote  



Similar Threads