How do you handle related media?

HandBrake for Windows support
Forum rules
An Activity Log is required for support requests. Please read How-to get an activity log? for details on how and why this should be provided.
Post Reply
gonzus
Posts: 21
Joined: Wed Feb 18, 2009 8:28 pm

How do you handle related media?

Post by gonzus »

I would like to hear how people handle media that is somehow related. I am talking about at least two cases:
  • What everyone refers to as joining, stitching or appending movies. A good example could be any of the three Lord of the Rings movies in their extended edition versions, where each movie is a set of two large DVDs. Say you rip those two DVDs and encode them into Part1.mkv and Part2.mkv to your heart's content. It certainly would be great to be able to create a single PartAll.mkv which looks as the two movies appended. I have come to the conclusion this is a non-trivial task that could pose several requirements to Part1 and Part2 (a single movie in each part, same aspect ratio / encoding / others, same audio tracks, same subtitle tracks, etc.). I also understand there is a paid-for product called DVD2OneX (DTOX) that handles this process, so it would seem it is at least possible to do it. I have also seen comments to the tone of "you can do this with PgcEdit by hand, but it is no easy task". Can anybody share the way they handle this? Or is this part of an eternal, never-fulfilled wish list?
  • Things that are not a logical single movie, but are related anyway. For example, I ripped three things from my Up DVD: the main movie and two shorts. I hate with a passion all the crap that comes in the DVD, but that doesn't mean I only want to keep the main movie... Anyway, using HandBrake I end up with three mkv files: Movie.mkv, Short1.mkv and Short2.mkv. Should I just handle them as three separate movies? Could I somehow bundle them into a single mkv file? If I do that, am I forcing myself to add some kind of navigational system to it? Could I? Anybody can comment on the way they handle this?
Thanks in advance and best regards.
mduell
Veteran User
Posts: 8187
Joined: Sat Apr 21, 2007 8:54 pm

Re: How do you handle related media?

Post by mduell »

For question one you can concatenate the source VOBs and end up with a usable file. cat in OS X, copy in Windows.
gonzus
Posts: 21
Joined: Wed Feb 18, 2009 8:28 pm

Re: How do you handle related media?

Post by gonzus »

Interesting, mduell... So you are saying I should do this with the VOBs, before using HandBrake. Let's say Part1 has three VOBs: VTS_01_{1,2,3}.VOB; and Part2 has four VOBs: VTS_02_{1,2,3,4}.VOB (I used VTS_01_* and VTS_02_* to be able to differentiate both parts, they would most likely both be called VTS_01_*). Are you saying that the following command:

Code: Select all

ffmpeg -i VTS_01_1.VOB -i VTS_02_1.VOB -vcodec copy -acodec copy movie.vob
will open the first VOB from Part1, copy it and VOBS 2 and 3 (all from Part1), and then move onto the first VOB from Part2, copy it and VOBS 2, 3 and 4 (all from Part2), outputting everything into movie.vob? So, in the end, movie.vob will have all the contents from the seven original VOBs, but as a single movie? That would be great!

What would happen to the soundtracks? Will they just be joined? How about the subtitle tracks?

If this works as I tried to describe, I guess movie.vob will be huge... Would HandBrake handle opening it and generating a nice MKV file from the mega-movie?

In the meantime, I will check ffmpeg's documentation... Thanks a lot!
mduell
Veteran User
Posts: 8187
Joined: Sat Apr 21, 2007 8:54 pm

Re: How do you handle related media?

Post by mduell »

Note my revised post. I had a brainfart the first time around.

copy /b VTS_01_1.VOB + VTS_01_2.VOB + VTS_01_3.VOB + VTS_03_1.VOB + VTS_03_2.VOB + VTS_02_3.VOB + VTS_02_4.VOB LOTR.VOB

Will put them all into a file called LOTR.VOB. It could be up to 19GB if both disks are dual layer at full capacity although VOB files on DVDs never exceed a gigabyte so 7GB in your example. Feed that to Handbrake.

Audio and subtitles should be fine as long as they're present on both disks in the same streams; if one disk has Chinese subtitles that the other disk lacks, then I doubt those will work.

Note this works for MPEG program steams, like you find on DVDs. You can't do it with most other media files.
rhester
Veteran User
Posts: 2888
Joined: Tue Apr 18, 2006 10:24 pm

Re: How do you handle related media?

Post by rhester »

It is worth noting, however, that you will lose chapter information when doing this. Not that there are any easy ways of preventing that. ;)

Rodney
gonzus
Posts: 21
Joined: Wed Feb 18, 2009 8:28 pm

Re: How do you handle related media?

Post by gonzus »

Hey mduell, I did notice the change in your reply while I was typing mine... Anyway, I tried concatenating all the VOBs and feeding them into ffmpeg; the only thing I added was a -scodec copy, so it would pass-thru the subtitle tracks as well. I must confess I had serious doubts this would work; don't VOB files have any headers / footers?

Well, the proof was in the pudding. It really worked! I tried it with two small shorts from the Up DVD and ended up with one large VOB containing both shorts. The layouts for the original shorts are:
  • short1: audio: 1 eng, 2 spa; video: 1; subtitles: none
  • short2: audio: 1 eng; video: 1; subtitles: none
The resulting VOB only shows one audio track (English), one video track and no subtitles track. Audio is English all the way through; I don't know if this is because it happened to be the first audio track in both original shorts, or because it was the only audio track in common between them (having the same language id).

Regarding chapter information, as posted by rhester: you are right. However, what I intend to do is to encode this mega-VOB with HandBrake; when I do that, I can build a chapters file by taking the chapters from the original discs and adding some offsets to the set from the second disk. Or am I over-simplifying this? Any suggestions as to how to determine the right offset to add?

The other question I have: I have read that when you join movies, they usually have a blank frame at the beginning and/or end, which means I will probably notice a flash on my finished product. If this is correct, what (hopefully free) tools could I use to prevent this?

I will make some tests during this weekend with my LOTR discs and report back. This is great!
tlindgren
Bright Spark User
Posts: 260
Joined: Sun May 03, 2009 2:14 pm

Re: How do you handle related media?

Post by tlindgren »

gonzus wrote:Regarding chapter information, as posted by rhester: you are right. However, what I intend to do is to encode this mega-VOB with HandBrake; when I do that, I can build a chapters file by taking the chapters from the original discs and adding some offsets to the set from the second disk. Or am I over-simplifying this? Any suggestions as to how to determine the right offset to add?
Since you're using mkv one alternative way to do this is to encode it to two mkv files, then join them using mkvmerge (from mkvtoolnix, http://www.bunkus.org/videotools/mkvtoolnix/).
This works fine, the only problem is that the chapters are then arranged in two groups (EditionEntry) which is legal but no reader I've ever heard of supports!

It's possible but tedious to merge them in the mkvmerge chapter editor (unless it's very few chapters), so to fix that you load the resulting mkv file into the Chapter editor, export the chapter file (XML) and fix it slightly in any text editor by removing the stuff that separates the two "EditionEntry", load the fixed copy into the Chapter editor and write it to the mkv file. Specifically, dropping the Edition* stuff between </ChapterAtom> and <ChapterAtom>, it shouldn't be hard to figure out.
gonzus
Posts: 21
Joined: Wed Feb 18, 2009 8:28 pm

Re: How do you handle related media?

Post by gonzus »

gonzus wrote:The resulting VOB only shows one audio track (English), one video track and no subtitles track. Audio is English all the way through; I don't know if this is because it happened to be the first audio track in both original shorts, or because it was the only audio track in common between them (having the same language id).
I did a test: loaded the movie with two audio tracks into IfoEdit and swapped the tracks' languages. The big concatenated VOB still has only one audio track which is English all the way. The conclusion is that the tracks are taken from the original VOBs in physical order, without paying attention to their stated language ids.
gonzus
Posts: 21
Joined: Wed Feb 18, 2009 8:28 pm

Re: How do you handle related media?

Post by gonzus »

tlindgren wrote:Since you're using mkv one alternative way to do this is to encode it to two mkv files, then join them using mkvmerge (from mkvtoolnix, http://www.bunkus.org/videotools/mkvtoolnix/). This works fine, the only problem is that the chapters are then arranged in two groups (EditionEntry) which is legal but no reader I've ever heard of supports!

It's possible but tedious to merge them in the mkvmerge chapter editor (unless it's very few chapters), so to fix that you load the resulting mkv file into the Chapter editor, export the chapter file (XML) and fix it slightly in any text editor by removing the stuff that separates the two "EditionEntry", load the fixed copy into the Chapter editor and write it to the mkv file. Specifically, dropping the Edition* stuff between </ChapterAtom> and <ChapterAtom>, it shouldn't be hard to figure out.
Yes tlindgren, I do use mkvtoolnix for my devious purposes. I tried once doing what you mention, but hit one problem: when I encoded Part1 and Part2 into separate MKVs using HandBrake, they ended up having slightly different picture sizes; mkvmerge refused to join them. I posted about this here, but got no comments: http://forum.handbrake.fr/viewtopic.php ... 970#p54970.

Any suggestions on how to exactly determine the proper offset to add to the chapters in Part2, so that they will match the final movie?
mduell
Veteran User
Posts: 8187
Joined: Sat Apr 21, 2007 8:54 pm

Re: How do you handle related media?

Post by mduell »

rhester: Good note; I don't care about chapters, so I never think of them.
gonzus wrote:Hey mduell, I did notice the change in your reply while I was typing mine... Anyway, I tried concatenating all the VOBs and feeding them into ffmpeg; the only thing I added was a -scodec copy, so it would pass-thru the subtitle tracks as well. I must confess I had serious doubts this would work; don't VOB files have any headers / footers?

Well, the proof was in the pudding. It really worked! I tried it with two small shorts from the Up DVD and ended up with one large VOB containing both shorts. The layouts for the original shorts are:
  • short1: audio: 1 eng, 2 spa; video: 1; subtitles: none
  • short2: audio: 1 eng; video: 1; subtitles: none
The resulting VOB only shows one audio track (English), one video track and no subtitles track. Audio is English all the way through; I don't know if this is because it happened to be the first audio track in both original shorts, or because it was the only audio track in common between them (having the same language id).
I'm a bit rusty on ffmpeg so I thought it would combine them as separate streams rather than concatenating them. Glad to hear it worked. Using copy should be a bit faster than ffmpeg. MPEG program streams, of which VOBs are an implementation, are designed for reliable transmission media (disks, not over the air) and the headers aren't that important.
tlindgren
Bright Spark User
Posts: 260
Joined: Sun May 03, 2009 2:14 pm

Re: How do you handle related media?

Post by tlindgren »

gonzus wrote:Yes tlindgren, I do use mkvtoolnix for my devious purposes. I tried once doing what you mention, but hit one problem: when I encoded Part1 and Part2 into separate MKVs using HandBrake, they ended up having slightly different picture sizes; mkvmerge refused to join them. I posted about this here, but got no comments: http://forum.handbrake.fr/viewtopic.php ... 970#p54970.
Obviously, don't use auto-crop if you plan to join them later... Scan both and select a good setting based on both crop values and visual inspection (I don't fully trust the auto-crop), and then use those settings on both. Regarding the question in the original post, you may well have had the original encoding log saved, see the FAQ for location, this gives you what was used so you can recreate it on the other one (or just re-encode both as above).

If the join is in a black section I think you may be able to get away with cropping the same amount vertically/horizontally but changing the relation between left/right and/or up/down (so say 8/4 left/right in the first, 6/6 in the second). IIRC if you use anamorphic-loose it will in fact join but with warnings if they ended up with the same number of pixels, but again unless the video is completely featureless around the join it'll stand out like a sore thumb. It's rare the either of these really make that much sense, identical cropping is usually the only sane option.
gonzus wrote:Any suggestions on how to exactly determine the proper offset to add to the chapters in Part2, so that they will match the final movie?
The offset should be exactly the length of the first part (or combined previous sections if more than one) . mkvmerge's Chapter Editor even allows you to adjust the time code for all chapters, making it ideal for this (you'd still need to join the chapter files manually afterwards though).
Post Reply