mkvextract and batch extraction

6

2

Is there a way to extract all attachments in a mkv file via mkvextract with batch?

Otherwise I need to give the name of all attachments one by one.

Plato

Posted 2012-07-06T08:51:11.243

Reputation: 81

Answers

6

If you run the following: mkvextract attachments file.mkv 1:1.ttf 2:2.ttf 3:3.ttf 4:4.ttf 5:5.ttf 6:6.ttf ... etc Then mkvextract will extract attachments by id until it can't find an attachment. It will exit when it fails to find an attachment, so the batch will progress. Disadvantage here is that you lost the attachment filenames, but without grepping around some mkvinfo output, this is the only way I know of to extract all the attachments.

Suchipi

Posted 2012-07-06T08:51:11.243

Reputation: 854

You can use bash's expansions: mkvextract attachments file.mkv {1..100} – Camilo Martin – 2016-09-29T12:44:09.160

Actually, I just learned that leaving the outname empty preserves the original filename, so you should just run mkvextract attachments file.mkv 1: 2: 3: 4: 5: 6:. – Suchipi – 2012-12-27T00:08:00.520

3Scratch that- should be mkvextract attachments 1 2 3 4 5 6 – Suchipi – 2012-12-27T00:46:24.093

1

For Bash you could use mkvextract attachments "$file" $(seq 1 100) to extract attachments 1 to 100, assuming that there are no more than 100 attachments. If you use another shell you'll have to find the equivalent of seq to generate a sequence of numbers, here's one for Powershell.

LiveWireBT

Posted 2012-07-06T08:51:11.243

Reputation: 737

+1 but don't use $(seq 1 100), bash has this natively: {1..100}. – Camilo Martin – 2016-09-29T12:43:11.393