Last active
September 30, 2021 22:55
-
-
Save nate-moo/44853f3c08fb4949fe081bd2b1c74640 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
import sys | |
import re | |
var = str(subprocess.check_output(["mkvmerge.exe", "--identify", "video.mkv"]).decode(sys.stdout.encoding)) | |
AttachmentID = re.findall(r"(Attachment ID (\d{1,2}):)", var) | |
AttachmentName = re.findall(r"(file name ('(.*)'))", var) | |
for a, b in zip(AttachmentID, AttachmentName): | |
funnymanjoe = subprocess.Popen(["mkvextract.exe", "video.mkv", "attachments", a[1] + ":" + b[2]]) | |
print(a[1] + b[1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add python script to same directory as mkvtoolnix executables (or have them on path) and the video file named "video.mkv"
If on linux remove ".exe" from executable files