Any ideas, how I could automate this?

MKV playback, recompression, remuxing, codec packs, players, howtos, etc.
Post Reply
Ezatoka
Posts: 411
Joined: Fri Dec 06, 2019 6:55 pm

Any ideas, how I could automate this?

Post by Ezatoka »

My situation:
I have a Matroska file, having duplicate and/or empty streams inside.

Example:
Image

For some reason, this example has tons of duplicate audio streams as well as empty subtitle streams.

After cleaning them up, it looks like this:
Image
so the streams 3 to 13 were either a binary duplicate of stream 1 or 2, stream 18 was a binary duplicate of stream 17.

This process so far I was able to automate. (I just drag the mkv file onto a batch file currently)

Now knowing the IDs of the tracks I want to keep (or other way around, knowing those I want to delete), how could I automate it now, that the streams I do not want anymore are removed from the Matroska file itself?

What would be the best now would be a way, to give e.g. mkvmerge the input file and the IDs I want to keep and it muxes a new file, with all other data like language of the streams, chapters, attachments etc. but only those stream IDs I want to keep, thus making the file smaller.
Grauhaar
Posts: 566
Joined: Thu Sep 15, 2016 3:46 pm

Re: Any ideas, how I could automate this?

Post by Grauhaar »

Use "MKVToolNIX GUI", load the mkv file, deselect the unwanted tracks (ID is shown) and remux.
Good Luck :)
_____________________________________________________________
Useful MakeMKV links: FAQs - Debug Log - Buy - Expiration of beta key
Two Blu-ray (UHD) Drives LG LG BH16NS55 with Libredrive Firmware 1.04
Ezatoka
Posts: 411
Joined: Fri Dec 06, 2019 6:55 pm

Re: Any ideas, how I could automate this?

Post by Ezatoka »

I asked for automated ways.

I will not quit my job so I have time to check and change several thousand Matroska files manually :)
Grauhaar
Posts: 566
Joined: Thu Sep 15, 2016 3:46 pm

Re: Any ideas, how I could automate this?

Post by Grauhaar »

Don't know why you have so many duplicate tracks in your mkv files ... sounds very strange

Anyway, if you know the remaning ids use mkvmerge with the "--track-order 0:1,0:2,0:3,0:4,0:5,0:6,0:7" option by specifiy all IDs which should be copied to the new mkv file. Any ID not in the list will not be copied!
Good Luck :)
_____________________________________________________________
Useful MakeMKV links: FAQs - Debug Log - Buy - Expiration of beta key
Two Blu-ray (UHD) Drives LG LG BH16NS55 with Libredrive Firmware 1.04
Ezatoka
Posts: 411
Joined: Fri Dec 06, 2019 6:55 pm

Re: Any ideas, how I could automate this?

Post by Ezatoka »

Grauhaar wrote:
Fri May 15, 2020 6:38 am
Don't know why you have so many duplicate tracks in your mkv files ... sounds very strange
Because MakeMKV ripped them like that. Looney Tunes Golden Collection BluRays.
As I can't know beforehand if there isn't some kind of orchestra track or commentary track within all those English streams, I ripped them all of course.

It's like that on each of the BluRays on nearly any movie.

Thank you for your suggestion with the track-order, I'll have to test it now.
Ezatoka
Posts: 411
Joined: Fri Dec 06, 2019 6:55 pm

Re: Any ideas, how I could automate this?

Post by Ezatoka »

Unfortunately, this doesn't work with track-order.

The manual says "If some track IDs are omitted then those tracks are created after the ones given with this option have been created." so it always adds all tracks, it's just the order I can change.
Grauhaar
Posts: 566
Joined: Thu Sep 15, 2016 3:46 pm

Re: Any ideas, how I could automate this?

Post by Grauhaar »

Okay, you are right. Never tested this, I just used it for adding an new subtitle track on the right place.

I think you should use the "--audio-tracks" option. If you know the IDs which should be removed, you can use f.e "!5,!6" (for track id 5 and 6) and omitting all other remaing Ids. I hope it works :D
Good Luck :)
_____________________________________________________________
Useful MakeMKV links: FAQs - Debug Log - Buy - Expiration of beta key
Two Blu-ray (UHD) Drives LG LG BH16NS55 with Libredrive Firmware 1.04
Ezatoka
Posts: 411
Joined: Fri Dec 06, 2019 6:55 pm

Re: Any ideas, how I could automate this?

Post by Ezatoka »

That worked like a charm, thank you very much! :D
Post Reply