Merging M4V files on a Mac ... with chapters!

This is an old post!

This post is over 2 years old. Solutions referenced in this article may no longer be valid. Please consider this when utilizing any information referenced here.

As I’ve mentioned a couple of times before, one of my projects right now is ripping all the DVDs I own so that I can watch them on my AppleTV (or any AppleTV in the house).

Well, one of the problems I’ve run into a couple of times is longer movies that are distributed on two discs. This is usually movies like the Lord of the Rings Extended Edition or The Ten Commandments. Really, they’re one movie, but are distributed as two separate movies because of the restrictions of physical media.

Well, digital media imposes no such restrictions on us, so why have two separate movies listed on the AppleTV? So after much trial and error, I finally discovered a way to get everything play nicely together. Unfortunately, this is not an easy problem to solve and even involved me writing a small script that could merge chapter files together because every single method I could find would eliminate chapter markers.

So here, in abbreviated form, is the process for merging m4v files together and preserving chapter markers.

Note: This tutorial assumes some level of technical proficiency. This is not a point-and-click process (yet :P) and requires the use of multiple tools and the shell.

Tools you’ll need:

  1. Handbrake or whatever tool you’re using for ripping your legally obtained DVDs.

  2. MetaX and/or iDentify

  3. Subler

  4. remux

  5. Quicktime, which is now built into Mac OS X.

  6. chaptermerge, a script I wrote that merges chapter files together.

The proces:

  1. Rip both movies from their individual DVDs using Handbrake or whatever other tool you’re using. Be sure that you’re adding chapter markers.

  2. Load each movie into MetaX and download the chapter names. That’s really the only thing you need to add to the file. Save the files with chapter names.

  3. Load each movie into Subler and extract the chapter files. To do this, select the chapter track and select File -> Export.

  4. Now, open the first movie in Quicktime.

  5. Drag the second movie on top of the first one. Quicktime will add the two together.

  6. Save the movie for use on an AppleTV. Get a beer or 6, because this takes awhile.

  7. While the movie is saving, use chaptermerge to merge the chapter files together. See the docs on how it works.

  8. Once the file has finished saving as a Quicktime MOV (it’s actually still h.264 inside the file), fire up remux and convert the merged file back into an m4v. Drag the file into remux, set the output to m4v, and save. Should be pretty quick - a matter of minutes.

  9. Load the merged file back into Subler and add the merged chapter track. Drag the chapter file into the Subler window. Save the file.

  10. Load the merged file into a tool such as iDentify or MetaX and add the remaining metadata.

That’s it! You now have a merged file with both parts of the movie, accurate chapter markers and full metadata, ready to be copied to iTunes and viewed on your AppleTV.

About the Author

Hi, I'm Rob! I'm a blogger and software developer. I wrote petfeedd, dystill, and various other projects and libraries. I'm into electronics, general hackery, and model trains and airplanes. I am based in Huntsville, Alabama, USA.

About Me · Contact Me · Don't Hire Isaiah Armstrong

Did this article help you out?

I don't earn any money from this site.

I run no ads, sell no products and participate in no affiliate programs. I do not accept gifts in exchange for articles, guest articles or link exchanges. I don't track you or sell your data. The only third-party Javascript on this website is Google Analytics.

In general I run this site very much like a 1990s homepage or early 2000s personal blog, meaning that I do this solely because it's fun! I enjoy writing and sharing what I learn.

If you found this article helpful and want to show your appreciation, a tip or donation would be very welcome. Feel free to choose from the options below.

Comments (0)

Interested in why you can't leave comments on my blog? Read the article about why comments are uniquely terrible and need to die. If you are still interested in commenting on this article, feel free to reach out to me directly and/or share it on social media.

Contact Me
Share It

Interested in reading more?

Apple

Creating an iTunes Dropbox on a Mac

Download I recently added a Mac mini to my setup at home, that I’m using to drive my in-home “video on demand” system. With many of the TV’s in the house on AppleTVs, any TV in the house can watch any movie in the library at any time. I put the mini (headless) in the closet, along with the Drobo and a printer. But, the new Mac mini lacks an optical drive. So, how to continue ripping the DVDs I already own? The solution, it turns out, is to continue doing the actual work on my iMac when it comes to ripping, filtering the files through iDentify and MetaX. But I don’t want to have to go to screen sharing on the Mini and add a file to iTunes. I want that to happen automatically. That’s where Automator - one of the most underrated pieces of software that comes with every Mac - comes in. With Automator, you can attach an action to a folder, so that that action will be performed whenever anything is added to that folder. So here’s what I did to get files from a folder into iTunes: Create a folder somewhere on your system. I put mine in my user directory. Open Automator. From the dialog box, select “Folder Action.” At the top, where it says “Folder Action receives files and folders added to,” select “Other” and select your new folder. Search for an action called “Set Var of Value”. Drag that action over to the right. From “Variable” select “New Variable.” Call it “Source” Search for an action called “Import Files into iTunes”. Drag that action over to the right underneath the variable action. Be sure to select “Library” from the empty dropdown. Search for an action called “Get Var of Value”. Drag that action over to the right underneath the iTunes action. Be sure the selected variable is “Source”. Search for an action called “Move Finder Items to Trash”. Drag that action over to the right. Search for an action called “Run AppleScript.” Drag that action over to the right. In the AppleScript action, paste this: {% highlight applescript %} on run {input, parameters} tell application “Finder” to empty trash return input end run {% endhighlight %} Save the action. You’re done.
Read More
Mac

Multiple Calibre Servers under Mac OS X

So there’s this program out there called Calibre which, despite it’s pretty terrible UI, is pretty much the gold standard for managing eBooks. Seriously, it’s such a great program whose only fault is its terrible engineer UI. One of the nice things that Calibre includes is a built-in web server that can serve books via OPDS. If you have an OPDS-compatible reader (I use Marvin), you can browse and download from your library directly on your device, basically creating your own private eBook cloud. But, this presents a little bit of an issue. Namely, I don’t want all of my books to be publicly available, while still providing a subset of my library for visitors to browse and use. But I still want to be able to access them myself from my “private reserve collection.” Fortunately, with a little bit of work, you can do that under Calibre.
Read More