Plex Forums: MakeMkv Automator - Plex Forums

Jump to content

  • 4 Pages +
  • 1
  • 2
  • 3
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

MakeMkv Automator Batch converion of video_ts and iso files to mkv

#1 User is online   Mikedm139 

  • Plugin Developer
  • PipPipPip
  • Group: Members
  • Posts: 1,026
  • Joined: 17-October 09
  • Gender:Male
  • Location:Canada
  • Interests:Plex, Movies, Plugins

Posted 11 September 2010 - 07:34 PM

With the release of Plex/9 and the associated iOS app, I was very excited to try it out (I haven't yet, even though I bought the app). The vast majority of my library is video_ts folders and iso (as well as img) files ripped from dvds. Since Plex won't stream video_ts or ISO formats to the iOS app, combined with the numerous complaints I've read about choppy playback of these files, I decided to convert to Mkv format.

I decided not to use Handbrake since I wanted lossless transcoding, but I was daunted by the task of converting 400+ movies one-at-a-time with MakeMkv (as it doesn't offer a batch conversion or queue like Handbrake).

With a little research and a lot of playing around, I've managed to write a script which uses the command line interface of MakeMkv to automate the process.

The program takes a folder full of movies (video_ts folders and iso images) and converts them to mkv format. The process isn't perfect, but it sure reduces the amount of time required babysitting the conversions. If you've got other movie files mixed in the folder, they'll be ignored. I also designed this script to skip any "special features" dvds, (as indicated by {special features, bonus disk, bonus materials} since I don't want my extra materials extracted to mkvs.

Using the program is simple. At run-time it will ask for:

(1) a folder to process
(2) a temporary folder to output mkv files to
(should be an empty folder with enough free hard-drive space to hold at least 1 or 2 5Gig mkv files)
(3) the final folder to place the finished mkv files
(can be the same as the original source folder)
(4) a minimum length of title to extract from the dvd-files (default: 60 minutes to avoid extracting trailers/special features/etc.)
(due to limitations of the MakeMkv command line interface and the process of automation, any titles longer than the specified mimimum length will be extracted - see known issues below)
(5) whether or not to delete the original files (default: yes , to save hard drive space)
(6) If you want Growl notification on completion.


Prior to running it, you must have MakeMkv on your system and install the command line interface and library (makemkvcon and libmakemkv.dylib) in your usr/bin/ folder. These files are in the MakeMkv app bundle (Contents/MacOS/). This can be accomplished with the sudo /usr/bin/install command. In a terminal window, navigate to the folder which contains the MakeMkv app (likely, the Applications folder). Then run the following commands (feel free to copy and paste):

cd /makemkv.app/contents/macos/

sudo /usr/bin/install makemkvcon /usr/bin/

sudo /usr/bin/install libmakemkv.dylib /usr/bin/

sudo /usr/bin/install libdriveio.dylib /usr/bin/


This should now allow makemkvcon as a shell script, which is necessary for this automator to work.

I am including the source as well. Anyone can feel free to make changes/additions however they choose. I ask only two things: first - give credit where credit is due, and second - post your changes to this thread for the benefit of all.

Attached File  MakeMkv Automator v1.zip (57.84K)
Number of downloads: 307
Attached File  MakeMkv Automator Source.zip (49.7K)
Number of downloads: 201

Known Issues:
- some files don't convert : Unfortunately MakeMkv can't handle everything. Apparently it often has troubles with files ripped using MacTheRipper. I used MTR extensively when uploading my DVD library and have still been able to convert a large number of files using this script and MakeMkv.
- more than one file is output : as mentioned above in the section on setting the minimum length, the command line interface for MakeMkv (makemkvcon) will , by default, extract all titles from a video_ts or iso. Setting a reasonable minimum length will minimize the number of garbage files extracted, but if a disk contains multiple versions of the movie (eg. theatrical and director's cut), the only way I know of to decide which one you get is to extract it manually.
- can't cancel conversions once started : the only way to cancel the process once it is running is to force quit.
- there's no logging : it's on my to-do list, but I wanted to get this out there for people to use now that I've got it working (essentially) the way I want it to.
- Forced Subtitles are no longer forced after conversion : Thanks to Compaulsive for pointing this out. It seems to be an known issue with MakeMkv. Hopefully MakeMkv will fix this in a new version.
0

#2 User is offline   Compaulsive 

  • Member
  • PipPip
  • Group: Members
  • Posts: 43
  • Joined: 26-October 09
  • Gender:Male
  • Location:St. Louis

Posted 12 September 2010 - 02:10 AM

I've been looking for a way to batch convert all my video_ts movies to .mkv, but now I'm worried about quality control problems. Thanks for your efforts on the script and taking time to post instructions. I found my .mkv converted videos don't preserve forced subtitles. For example, movies like 30 days of night, frost/nixon, return of the jedi. There's no easy way that I know of to discern which video_ts files contain forced subtitles and remove them from the conversion process.

I guess one could manually add a .srt file to those movies if you can find a .srt with just the forced dialogue.

Thoughts?
HTPC: Mac Mini (Mid 2011) - 2.5 Intel Core i5, 4GB
Storage: Synology 1511+ (5 x 3TB)
Audio: Pioneer VSX-1021 7.1
Speakers: Energy 5.1 Take Classic Home Theater System
Television: Panasonic TH-42PZ700U
Inputs: Harmony One, Apple Bluetooth Keyboard, Magic Mouse, Hippo Remote
Ripping/Encoding: Custom Built Overclocked PC - 3.67 GHz Quad Core (i7 920), 500 GB, Blu-ray
Misc: TiVo Premiere, PS3, Xbox 360, Wii, IR2BT, Time Capsule (500 GB), C1C Antenna (OTA)
0

#3 User is online   Mikedm139 

  • Plugin Developer
  • PipPipPip
  • Group: Members
  • Posts: 1,026
  • Joined: 17-October 09
  • Gender:Male
  • Location:Canada
  • Interests:Plex, Movies, Plugins

Posted 12 September 2010 - 03:40 AM

View PostCompaulsive, on 12 September 2010 - 02:10 AM, said:

I've been looking for a way to batch convert all my video_ts movies to .mkv, but now I'm worried about quality control problems. Thanks for your efforts on the script and taking time to post instructions. I found my .mkv converted videos don't preserve forced subtitles. For example, movies like 30 days of night, frost/nixon, return of the jedi. There's no easy way that I know of to discern which video_ts files contain forced subtitles and remove them from the conversion process.

I guess one could manually add a .srt file to those movies if you can find a .srt with just the forced dialogue.

Thoughts?


The way the command line interface is implemented, I believe it should preserve all subtitles that are in the TS files. I have not been doing extensive checking on the results. After my first couple tests came out well, I focused more on the functionality of the script.

I'll check some of my files and let you know what I find.
0

#4 User is offline   jbreeden 

  • Dedicated Member
  • PipPipPip
  • Group: Members
  • Posts: 120
  • Joined: 10-September 10

Posted 12 September 2010 - 04:19 AM

first off, thanks for your efforts.

thus far i've been unable to get this script to work, though. I'm not proficient with the terminal, but I did do what you said to do. i corrected the second ssudo to sudo, though. When i tried to install, it asked for my password, then came up with a usage explanation for "install." I'm not sure if that means it didn't work, or what.

Beyond that, after I installed BP progress bar (you forgot to mention that), When it ran, it skipped past a whole folder full of files and returned nothing. These are all just normally titled movie folders, each with a video_ts folder inside.

I'm 100 movies into a 300 movie conversion process to mkv, and this is exactly what i've been waiting for, if only I can make it work! please help!

Oh, and as a side note. The MakeMKV/MacTheRipper is a known bug. The solution I've found for it is to remaster in Dvd2OneX(DTOX) using no compression, and then run it through makemkv. Whatever DTOX does to the headers of the files has made it work for over 100 Movie-only MTR rips on my computers. Fortunately DTOX allows you to queue jobs.
Mac Mini - 2010 Unibody, 2.4GHz, 2GB - 46" Sony Bravia LCD TV, Sony STR-DN1000 Receiver
20TB Custom NAS, Solaris 11 Express, raidz2, 10x2TB
0

#5 User is online   Mikedm139 

  • Plugin Developer
  • PipPipPip
  • Group: Members
  • Posts: 1,026
  • Joined: 17-October 09
  • Gender:Male
  • Location:Canada
  • Interests:Plex, Movies, Plugins

Posted 12 September 2010 - 05:47 AM

View Postjbreeden, on 12 September 2010 - 04:19 AM, said:

first off, thanks for your efforts.

thus far i've been unable to get this script to work, though. I'm not proficient with the terminal, but I did do what you said to do. i corrected the second ssudo to sudo, though. When i tried to install, it asked for my password, then came up with a usage explanation for "install." I'm not sure if that means it didn't work, or what.

Beyond that, after I installed BP progress bar (you forgot to mention that), When it ran, it skipped past a whole folder full of files and returned nothing. These are all just normally titled movie folders, each with a video_ts folder inside.

I'm 100 movies into a 300 movie conversion process to mkv, and this is exactly what i've been waiting for, if only I can make it work! please help!

Oh, and as a side note. The MakeMKV/MacTheRipper is a known bug. The solution I've found for it is to remaster in Dvd2OneX(DTOX) using no compression, and then run it through makemkv. Whatever DTOX does to the headers of the files has made it work for over 100 Movie-only MTR rips on my computers. Fortunately DTOX allows you to queue jobs.


Thanks for your feedback. Let's see if we can figure out what's going on. A couple questions for starters: Did you download the application (v1) or the zip with source script and resources? The folder that it skipped, was it the one you selected as your source folder or was it nested inside of that? Can you open a terminal window and just run the makemkvcon command? If it's properly installed, you should get info on using makemkvcon returned.

Thanks for the DTOX tip. I'll have to try that with my files.
0

#6 User is offline   jbreeden 

  • Dedicated Member
  • PipPipPip
  • Group: Members
  • Posts: 120
  • Joined: 10-September 10

Posted 12 September 2010 - 06:13 AM

View PostMikedm139, on 12 September 2010 - 05:47 AM, said:

Thanks for your feedback. Let's see if we can figure out what's going on. A couple questions for starters: Did you download the application (v1) or the zip with source script and resources?

I downloaded the application without the source. I just now realized that the BP Progress Bar is in the source version. Do I need those 2 files placed anywhere specific?

Quote

The folder that it skipped, was it the one you selected as your source folder or was it nested inside of that?


Nested inside. I made a folder to test this out with(rather than going for 50 at a time) and put 10 folders inside of it, each a named "movie" folder containing a VIDEO_TS folder. The script goes through the motions, I see the progress bar pass by each movie like it should, it says it's converting, however it just blinks by all 10 folders without any conversions taking place.

Attached File  progress.png (28.35K)
Number of downloads: 8

then after it's done I see this come up in growl:

Attached File  growl.png (66.84K)
Number of downloads: 4

Quote

Thanks for the DTOX tip. I'll have to try that with my files.


:)

jbreeden
Mac Mini - 2010 Unibody, 2.4GHz, 2GB - 46" Sony Bravia LCD TV, Sony STR-DN1000 Receiver
20TB Custom NAS, Solaris 11 Express, raidz2, 10x2TB
0

#7 User is online   Mikedm139 

  • Plugin Developer
  • PipPipPip
  • Group: Members
  • Posts: 1,026
  • Joined: 17-October 09
  • Gender:Male
  • Location:Canada
  • Interests:Plex, Movies, Plugins

Posted 12 September 2010 - 06:23 AM

View Postjbreeden, on 12 September 2010 - 06:13 AM, said:

I downloaded the application without the source. I just now realized that the BP Progress Bar is in the source version. Do I need those 2 files placed anywhere specific?



Nested inside. I made a folder to test this out with(rather than going for 50 at a time) and put 10 folders inside of it, each a named "movie" folder containing a VIDEO_TS folder. The script goes through the motions, I see the progress bar pass by each movie like it should, it says it's converting, however it just blinks by all 10 folders without any conversions taking place.

jbreeden


Try running "makemkvcon" in the terminal. What happens?

Btw, the BP progress bar files should already be included in the app bundle. You shouldn't need to do anything with them. Since the progress bar works, you can leave them alone.
0

#8 User is offline   jbreeden 

  • Dedicated Member
  • PipPipPip
  • Group: Members
  • Posts: 120
  • Joined: 10-September 10

Posted 12 September 2010 - 06:37 AM

View PostMikedm139, on 12 September 2010 - 06:23 AM, said:

Try running "makemkvcon" in the terminal. What happens?


jbreeden$ makemkvcon
dyld: Library not loaded: @executable_path/libdriveio.dylib
  Referenced from: /usr/bin/makemkvcon
  Reason: image not found
Trace/BPT trap


well this looks like we're getting somewhere.
Mac Mini - 2010 Unibody, 2.4GHz, 2GB - 46" Sony Bravia LCD TV, Sony STR-DN1000 Receiver
20TB Custom NAS, Solaris 11 Express, raidz2, 10x2TB
0

#9 User is online   Mikedm139 

  • Plugin Developer
  • PipPipPip
  • Group: Members
  • Posts: 1,026
  • Joined: 17-October 09
  • Gender:Male
  • Location:Canada
  • Interests:Plex, Movies, Plugins

Posted 12 September 2010 - 06:53 AM

View Postjbreeden, on 12 September 2010 - 06:37 AM, said:

jbreeden$ makemkvcon
dyld: Library not loaded: @executable_path/libdriveio.dylib
 Referenced from: /usr/bin/makemkvcon
 Reason: image not found
Trace/BPT trap


well this looks like we're getting somewhere.


Agreed. Hmmm, It's requesting a second library that's included with MakeMkv. I don't remember needing to install that to get mine working, but that's a relatively easy fix. In the terminal, navigate back to your applications folder or where-ever MakeMkv is installed (or just open it in the finder and drag it into the terminal window). Then run the command:
cd /makemkv.app/contents/macos/

Followed by:
sudo /usr/bin/install libedrieio.dylib


After that, run another test with the command:
makemkvcon

0

#10 User is offline   jbreeden 

  • Dedicated Member
  • PipPipPip
  • Group: Members
  • Posts: 120
  • Joined: 10-September 10

Posted 12 September 2010 - 07:09 AM

That did the trick! You, sir, are the HEAT! the computer is churning away without any help from me! I shall watch this thread with great excitement for any updates/improvements, this is really really awesome!

jbreeden
Mac Mini - 2010 Unibody, 2.4GHz, 2GB - 46" Sony Bravia LCD TV, Sony STR-DN1000 Receiver
20TB Custom NAS, Solaris 11 Express, raidz2, 10x2TB
0

#11 User is online   Mikedm139 

  • Plugin Developer
  • PipPipPip
  • Group: Members
  • Posts: 1,026
  • Joined: 17-October 09
  • Gender:Male
  • Location:Canada
  • Interests:Plex, Movies, Plugins

Posted 12 September 2010 - 07:14 AM

View Postjbreeden, on 12 September 2010 - 07:09 AM, said:

That did the trick!


Great! Let me know if you run in to any other problems. I've updated the instructions in the first post to include installing that file.
0

#12 User is online   Mikedm139 

  • Plugin Developer
  • PipPipPip
  • Group: Members
  • Posts: 1,026
  • Joined: 17-October 09
  • Gender:Male
  • Location:Canada
  • Interests:Plex, Movies, Plugins

Posted 12 September 2010 - 11:29 PM

View PostCompaulsive, on 12 September 2010 - 02:10 AM, said:

I've been looking for a way to batch convert all my video_ts movies to .mkv, but now I'm worried about quality control problems. Thanks for your efforts on the script and taking time to post instructions. I found my .mkv converted videos don't preserve forced subtitles. For example, movies like 30 days of night, frost/nixon, return of the jedi. There's no easy way that I know of to discern which video_ts files contain forced subtitles and remove them from the conversion process.

I guess one could manually add a .srt file to those movies if you can find a .srt with just the forced dialogue.

Thoughts?


I checked my converted copies of A New Hope and Return of the Jedi. It seems what you say about the forced subtitles being removed is true. In both cases, specifically Han and Greedo as well as Jabba, the forced subtitles are preserved in a separate subtitle option which is no longer forced. I don't know if that is the case for all versions of these movies or other movies that contain forced subtitles. Your idea about finding .srt files with just forced subtitles seems a good one. I don't usually download subtitles, but I might see what I can find.
0

#13 User is offline   Compaulsive 

  • Member
  • PipPip
  • Group: Members
  • Posts: 43
  • Joined: 26-October 09
  • Gender:Male
  • Location:St. Louis

Posted 13 September 2010 - 12:07 AM

View PostMikedm139, on 12 September 2010 - 11:29 PM, said:

I checked my converted copies of A New Hope and Return of the Jedi. It seems what you say about the forced subtitles being removed is true. In both cases, specifically Han and Greedo as well as Jabba, the forced subtitles are preserved in a separate subtitle option which is no longer forced. I don't know if that is the case for all versions of these movies or other movies that contain forced subtitles. Your idea about finding .srt files with just forced subtitles seems a good one. I don't usually download subtitles, but I might see what I can find.

My bigger concern is I don't know for certain which files have forced subtitles. Some titles are known like Jedi, Avatar, District 9, etc., but you wouldn't think movies like frost/nixon and a single man have them, but they do. I hate the idea of starting to watch a movie with friends over and you find out sections of the movie aren't working properly. I think for the moment I'm going to stick with video_ts and forego streaming these films with iOS apps.
HTPC: Mac Mini (Mid 2011) - 2.5 Intel Core i5, 4GB
Storage: Synology 1511+ (5 x 3TB)
Audio: Pioneer VSX-1021 7.1
Speakers: Energy 5.1 Take Classic Home Theater System
Television: Panasonic TH-42PZ700U
Inputs: Harmony One, Apple Bluetooth Keyboard, Magic Mouse, Hippo Remote
Ripping/Encoding: Custom Built Overclocked PC - 3.67 GHz Quad Core (i7 920), 500 GB, Blu-ray
Misc: TiVo Premiere, PS3, Xbox 360, Wii, IR2BT, Time Capsule (500 GB), C1C Antenna (OTA)
0

#14 User is online   Mikedm139 

  • Plugin Developer
  • PipPipPip
  • Group: Members
  • Posts: 1,026
  • Joined: 17-October 09
  • Gender:Male
  • Location:Canada
  • Interests:Plex, Movies, Plugins

Posted 13 September 2010 - 02:52 AM

View PostCompaulsive, on 13 September 2010 - 12:07 AM, said:

My bigger concern is I don't know for certain which files have forced subtitles. Some titles are known like Jedi, Avatar, District 9, etc., but you wouldn't think movies like frost/nixon and a single man have them, but they do. I hate the idea of starting to watch a movie with friends over and you find out sections of the movie aren't working properly. I think for the moment I'm going to stick with video_ts and forego streaming these films with iOS apps.



I totally understand where you're coming from. If I come across a way to maintain forced subtitles I'll be sure to post here about it and include it in the script if I can.
0

#15 User is offline   Trähandlarn 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 8
  • Joined: 31-August 10

Posted 13 September 2010 - 10:44 AM

Great initiative!

I too seem to be having the same install issue as jbreeden though (although it seems his problems magically solved themselves :) )

sudo /usr/bin/install makemkvcon

only renders me:
usage: install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
               [-o owner] file1 file2
       install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
               [-o owner] file1 ... fileN directory
       install -d [-v] [-g group] [-m mode] [-o owner] directory ...


I tried to read up on the Install command but since I'm not exactly sure what I'm trying to accomplish here I reckoned a little help might be needed...

And, yes, I ran the command from the directory specified :)
0

#16 User is online   Mikedm139 

  • Plugin Developer
  • PipPipPip
  • Group: Members
  • Posts: 1,026
  • Joined: 17-October 09
  • Gender:Male
  • Location:Canada
  • Interests:Plex, Movies, Plugins

Posted 13 September 2010 - 12:25 PM

View PostTrähandlarn, on 13 September 2010 - 10:44 AM, said:

Great initiative!

I too seem to be having the same install issue as jbreeden though (although it seems his problems magically solved themselves :) )

sudo /usr/bin/install makemkvcon

only renders me:
usage: install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
 [-o owner] file1 file2
 install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
 [-o owner] file1 ... fileN directory
 install -d [-v] [-g group] [-m mode] [-o owner] directory ...


I tried to read up on the Install command but since I'm not exactly sure what I'm trying to accomplish here I reckoned a little help might be needed...

And, yes, I ran the command from the directory specified :)


Try adding "/usr/bin/" to the end of the command. So it should look like this:

sudo /usr/bin/install makemkvcon /usr/bin/


Do the same for the other two files as well.
0

#17 User is offline   Trähandlarn 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 8
  • Joined: 31-August 10

Posted 13 September 2010 - 06:28 PM

View PostMikedm139, on 13 September 2010 - 12:25 PM, said:

Try adding "/usr/bin/" to the end of the command. So it should look like this:

sudo /usr/bin/install makemkvcon /usr/bin/


Do the same for the other two files as well.


That did the trick. Although now I get either a Segmentation fault or a Bus error and the script crashes on launch...

I'll give it a shot with the sourcecode later tonight.

Edit:
Seems to be working well enough from the Script Editor! Great work!

This post has been edited by Trähandlarn: 13 September 2010 - 09:15 PM

0

#18 User is online   Mikedm139 

  • Plugin Developer
  • PipPipPip
  • Group: Members
  • Posts: 1,026
  • Joined: 17-October 09
  • Gender:Male
  • Location:Canada
  • Interests:Plex, Movies, Plugins

Posted 13 September 2010 - 09:26 PM

View PostTrähandlarn, on 13 September 2010 - 06:28 PM, said:

That did the trick. Although now I get either a Segmentation fault or a Bus error and the script crashes on launch...

I'll give it a shot with the sourcecode later tonight.


That's odd. I haven't seen that yet. How far does it get when you launch it? Do any of the prompts come up? Or, does it fail before it gets going at all? Do you get an error message of any kind? I hope we can figure it out, to help you and anyone else who might run into this.

Feel free to have a go with the source. A note about it: it's just AppleScript which I then save as an application bundle. The code relies on an add-on to display the progress bar, which is saved in the "resources" folder. When I build the app bundle, I then copy those files into the app bundle "makemkv Automator.app/contrents/resources/scripts/". If you want to run the script from source without building it, there's a line of code directing it to the progress bar files (to run from source) which is commented out. Just uncomment it and comment out the line that directs it to the files in the .app bundle. I'm not at my computer right now or I'd quote the exact lines. There are decent comments to let you know what's going on.

I'll try to remember to edit this post with more exact directions when I get home. I should probably add a readme to the source zip with this info too.

Let me know how it goes.

[Edit] LOL. I took too long writing my reply. Just saw your edit. Glad to see that's working for you.
0

#19 User is offline   Trähandlarn 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 8
  • Joined: 31-August 10

Posted 14 September 2010 - 07:13 AM

View PostMikedm139, on 13 September 2010 - 09:26 PM, said:

That's odd. I haven't seen that yet. How far does it get when you launch it? Do any of the prompts come up? Or, does it fail before it gets going at all? Do you get an error message of any kind? I hope we can figure it out, to help you and anyone else who might run into this.


It gets nowhere at all actually... I'll PM you a crash report when I get the chance.

Quote

[Edit] LOL. I took too long writing my reply. Just saw your edit. Glad to see that's working for you.


Checked again this morning and I'm all the way through "T". :) Should have my new-and-improved library up and running by the time I get home from work!
Thanks again for the effort!
0

#20 User is offline   spadrille 

  • Member
  • PipPip
  • Group: Members
  • Posts: 50
  • Joined: 01-April 09

Posted 22 December 2010 - 11:42 PM

I'm not familiar at all with the Terminal. I try to do what you said but how can i do that "In a terminal window, navigate to the folder which contains the MakeMkv" ?
0

Share this topic:


  • 4 Pages +
  • 1
  • 2
  • 3
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users