INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: MKV muxing script  (Read 9824 times)

leezer3

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1589
MKV muxing script
« on: April 11, 2008, 07:47:00 pm »

Current changes:
(V.03b)
Fixed again, might work this time hopefully!
(V.03a)
Stupid fix for muxing anything other than AVIs, my fault  ::)
Fixed a small logging error. Wouldn't have affected anything, but the log is now right if you try to mux an unsupported file.
(V.03)
Added MP4 muxing. The script will now also mux subtitles.
(V.02)
Added OGM muxing & deleting the original source file to the possible options.

Overview:
This script uses MrChriZ's scritping plugin to mux video files in Playing Now into MKV format with MKV Merge.
Please don't assume its ready for primetime/ use on a live library- Its not, so please test on non-critical data first! Again, my coding may not be the best, but I think just about everything works as intended.
Subtitles:
These must be in the same folder and have the same name as your source video file.
They are not currently deleted :)

Available variables
These are the variables, which should be altered depending on how you want the script to run-
Quote
const bool autoupdate=false;
true: The source AVI will be renamed to .avi.bak or deleted (See below), and the new MKV will be inserted into the library (The filename remains the same throughout).
false: You will be prompted as to whether to update the library with each muxed file. Choosing 'No' will produce both an AVI & an MKV with the same name, regardless of whether you have selected to delete or rename files :)
Quote
const bool ogmmux=false;
Determines whether OGMs should be muxed. This requires MKV Merge v2.2.0 or above.
Quote
const bool avimux=true;
Determines whether AVIs should be muxed.
Quote
const bool deletefiles=true;
WARNING: SEVERE DATA DAMAGE/ LOSS POTENTIAL!!!
true: The source file will be deleted if a MKV is muxed. If the file is already MKV or you have selected not to mux this filetype your original file will remain intact.
false: Your original file will be re-named .avi.bak/ .ogm.bak This is the default option, I'd advise only changing it if you are 100% sure things will work out fine ;)

A detailed log file may be found in %temp%\MKVMux_Log.txt (This logs to the scripting plugin console as well, but the detailed log should give times, as well as being persistant)

Download link-
Code: [Select]
http://www.bvecornwall.co.uk/downloads/mkvmux.txt
Copy & paste into the scripting plugin editor.

-Leezer-
Logged

leezer3

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1589
Re: MKV muxing script
« Reply #1 on: April 14, 2008, 07:18:57 pm »

OK, actually got pretty much everything working as intended  :o
I'd class this as ready for limited public consumption, but I need feedback please.

Cheers

-Leezer-
Logged

Mr ChriZ

  • Citizen of the Universe
  • *****
  • Posts: 4375
  • :-D
Re: MKV muxing script
« Reply #2 on: April 15, 2008, 04:02:02 am »

Nice bit of scripting there.
Sounds useful, I'll give it a go later.

 :)

alaskatu

  • Junior Woodchuck
  • **
  • Posts: 68
Re: MKV muxing script
« Reply #3 on: August 31, 2008, 02:19:51 am »

 :D, That is a amasing Feature that should be implemented im MC 13! Any chance to ad the library Tags to MKVs too? Thanks very much!

Logged

park

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2358
  • I wish I had more to say!
Re: MKV muxing script
« Reply #4 on: September 01, 2008, 12:21:00 pm »

I have just spent the evening playing with mkvmerge for the first time. I have been adding my subtitle files and movie posters whilst converting my mp4s to mkvs. This script looks fantastic. If it could do subtitles (I dont know how it could be automatied, but if they are in the same directory and named the same, that would be good enough) then your script could save me days of labor.
Logged

leezer3

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1589
Re: MKV muxing script
« Reply #5 on: September 01, 2008, 01:30:35 pm »

Nice thought, script modified to suit :)
Final (Lol) edit- Script has been fixed and attached to the first post as I kept hitting character limits. Any bugs please let me know.

I will also re-iterate, please do NOT use on a production library or your only copy of a set of files. While this script & MKV Merge will work 99% of the time, occasionally something can and does go wrong.

-Leezer-
Logged

park

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2358
  • I wish I had more to say!
Re: MKV muxing script
« Reply #6 on: September 06, 2008, 06:34:29 am »

I just tried this script on an mp4 and it told me "Nothing to do here - Wrong format"
Logged

park

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2358
  • I wish I had more to say!
Re: MKV muxing script
« Reply #7 on: September 06, 2008, 06:45:27 am »

I tried it on an avi and it completed successfully in about 2 seconds, and has renamed the avi to .bak, but there is no mkv file. It should be in the same directory as the avi was right?
Logged

park

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2358
  • I wish I had more to say!
Re: MKV muxing script
« Reply #8 on: September 07, 2008, 05:38:23 am »

where does the mkvmerge.exe need to be? I setup mkvtoolnix to install to Program Files. Could this be the problem? Should mkvmerge.exe be in the windows directory?
Logged

leezer3

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1589
Re: MKV muxing script
« Reply #9 on: September 08, 2008, 06:21:00 am »

Should work with the default MKVToolnix install, I've never changed anything, & I've tested the script extensively on both Vista & XP boxes.
Also, if it can't find MKVMerge, there should be chunk of complaining log at the bottom of the plugin window :)

The MKV should be in the same folder, with the same name as the .avi, so something obviously didn't work right.
First can you try your AVI with the MKVMerge GUI please?- MKVMerge throws a hissy fit with some files (I can't find any reason for this either), and you may just have found one  :P

Cheers

-Leezer-

Logged

park

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2358
  • I wish I had more to say!
Re: MKV muxing script
« Reply #10 on: September 08, 2008, 08:16:59 pm »

Hi Leezer,
After reading the log file that the script produced, it renamed my avi ok but it seems that it thinks that mp4 hasnt been set to mux either. But in the script I am sure that all the filetypes are set to "TRUE".

I'll post the log file later, when i get home.
Logged

leezer3

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1589
Re: MKV muxing script
« Reply #11 on: September 09, 2008, 10:11:38 am »

Sorry, my fault entirely- Was using an is as opposed to an is-not where I shouldn't have been. (Fixes anything other than AVIs only, not sure what's up with your AVI)
Try the new attachment :)

-Leezer-
Logged

park

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2358
  • I wish I had more to say!
Re: MKV muxing script
« Reply #12 on: September 11, 2008, 10:33:00 am »

I just tried it with your new script and it threw this up in the message area:

Running Script...
\\HPSERVER\Videos\Matroska Files\Pending\AXDS 1152.Title7.DVDRip.mp4
Nothing to do here- A MKV already exists for this file.
\\HPSERVER\Videos\Matroska Files\Pending\AXDS 1152.Title7.DVDRip.mp4
Nothing to do here- The script didn't recognise your file.
Please check whether your file is in one of the supported formats.
Script Completed Successfully


Could it be all the periods in the filename? Maybe it doesnt know which one is the file type.
Logged

leezer3

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1589
Re: MKV muxing script
« Reply #13 on: September 18, 2008, 06:14:44 pm »

Apologies for the delay in this response, but still  :P
For what its worth, that should have only been a logging error; As far as I can test the MKV should have been produced correctly.
Notwithstanding that, I've fixed the logging (Again!), and uploaded the revised script to my server, link is in the first post.

(The forum's upload is broken again)

Cheers

-Leezer-
Logged

park

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2358
  • I wish I had more to say!
Re: MKV muxing script
« Reply #14 on: September 19, 2008, 01:55:01 pm »

Thanks I'll try it again. By the way how long till the mkv should show up in the folder? Can you see the mkv file in the folder while it's being generated?

And what would happen if I run the script once on one file and then once on another file, before the first file had finished muxing? Will it start the second mux in a new instance, or stop the first one and start the second?

I'll report back after another play.
Logged

leezer3

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1589
Re: MKV muxing script
« Reply #15 on: September 20, 2008, 05:26:07 pm »

The MKV should be visible while it's being generated, but won't be complete until the MKVMerge (DOS) window disappears. Currently I can't think of an easy way to catch errors which aren't directly generated by the script, so if MKVMerge dies halfway through you may be left with a broken MKV.

For what it's worth, unless you terminate the script, the plugin should work it's way through each file in Playing Now in sequence.

I wouldn't reccomend trying to run two instances of the script- While it may well be possible, its liable to cause nasty fighting between the two, and I don't know how threadsafe the scripting plugin is :)
As always, please test on a copy of your files, and preferably not the main library.

Cheers

-Leezer-
Logged
Pages: [1]   Go Up