VideoSlimmer - remove unwanted audio/subs from mkv's


binhex

Recommended Posts

Hi guys, i have created a Python script to remove unwanted audio and subtitle tracks from Matroska container formatted files, the script uses mkvmerge (from mkvtoolnix) to identify and then remove unwanted audio and subtitles.

 

The reason for wanting to do this is file size, i have run this script across my media library and it did save a fair amount of space (approx 100GB), i now also run this on any new media i have recently acquired.

 

So without further ado here is a link to it, you will find the installation, syntax and examples here:-

 

link to prereq's and usage:-

https://github.com/binhex/videoslimmer

 

link to source here:-

https://github.com/binhex/videoslimmer/releases

 

Let me know how you get on with it, any questions please post here and i will get back to you.

  • Like 1
Link to comment

Sounds really cool!

Will definitely give this a go.

Thanks!

 

Excellent! Please let me know how you get on, quick word of warning, whilst I have tested this extensively and run it against my own media collection (approx 1000 movies), I would advise that you copy a few movies to a test area and make sure the resulting files are what you expected. Any feature requests also welcome.

 

binhex.

Link to comment

When I create my MKVs using makemkv I leave out all the extra audio and subs but keep the forced subs.  My only problem is on some movies the forced sub in the MKV does not have the default flag after ripping.  What I have done to fix this is to use mkvmerge to change the flag to default.  Can this script be used to take the subs and add the default flag.

Link to comment

I process all my movies with mkvmerge to add-in (if separate) or keep all the audio tracks and subtitles, setting the default play language to English, or English subs if foreign audio and setting the forced flag on subs that should be English forced.

 

Resulting filename would be...

 

Notebook, The (2004) HD1080p,TH,FR,DE,IT.mkv

 

It makes it really easy to search for a movie with (say) Thai audio or subs so my kids can watch it with me, just windows search for ",TH"  (we live in Thailand)

Link to comment
  • 7 months later...
  • 2 years later...

@binhex

 

This is a great idea. A friend wrote his own version but not as good! Just started (and aborted) a large dry run. Looks good and thank you for adding that requested function ;)  

 

Is there (didnt get to end!) a way to stop it reporting warnings for each JPG, AVI etc file (the screen scrolls past very quick!)?

Does it also report total savings at the end of a run?

Is there an easy way to add this to say SABnzbd downloading as a script so each downloaded movie gets auto processed? I see someone asked for that for NZBget over at your github but no response. Seems a great idea to me. Then all you need do is run the script on your whole library ONCE and clean as you download ;)

 

Link to comment
  • 2 years later...

Attempting to run this on my windows machine to slim my Unraid share.

 

installed MKVtoolnix

installed python v2.7.16

 

CMD - Administrator 

cd c:\videoslimmer\

VideoSlimmer.py --mkvmerge "c:\Program Files\mkvtoolnix\mkvmerge.exe" --media \\BIG-D\movies --lang eng

 

keep getting error on all mkv files :

 

2019-09-29 20:04:24,016 INFO VideoSlimmer videoslimmer :: Processing file \\BIG-D\movies\Guardians of the Galaxy Vol. 2 (2017)\Guardians of the Galaxy Vol. 2 (2017) - 4K HDR.mkv
2019-09-29 20:04:24,109 WARNING VideoSlimmer videoslimmer :: mkvmerge failed to identify file %s

 

any ideas what im doing wrong?   i get this error on every mkv,  my first run was not dry and it did not alter one file of 2000 movies....

 

 

NEVERMIND.... I found a program called MKV Optimizer.  Windows program with GUI.  Nice and simple for a noob like me.

 

Edited by TRusselo
Link to comment
  • 3 months later...
  • 2 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.