2

I have an mkv film and a separate mkv with an introduction by the director. I'm trying to use mkvmerge to concatenate them. However, the film has subtitles and the intro has no subtitles, and this seems to be causing a problem.

Specifically, the track output from mkvinfo intro.mkv is:

| + A track | + Track number: 1 (track ID for mkvmerge & mkvextract: 0) | + Track UID: 1 | + Track type: video | + Default flag: 0 | + Lacing flag: 0 | + MinCache: 2 | + Codec ID: V_MPEG2 | + CodecPrivate, length 164 | + Default duration: 33.367ms (29.970 frames/fields per second for a video track) | + Video track | + Pixel width: 720 | + Pixel height: 480 | + Display width: 853 | + Display height: 480 | + A track | + Track number: 2 (track ID for mkvmerge & mkvextract: 1) | + Track UID: 2 | + Track type: audio | + Codec ID: A_AC3 | + Default duration: 32.000ms (31.250 frames/fields per second for a video track) | + Name: Stereo | + Audio track | + Sampling frequency: 48000 | + Channels: 2

and mkvinfo film.mkv gives:

| + A track | + Track number: 1 (track ID for mkvmerge & mkvextract: 0) | + Track UID: 1 | + Track type: video | + Default flag: 0 | + Lacing flag: 0 | + MinCache: 1 | + Codec ID: V_MS/VFW/FOURCC | + CodecPrivate, length 74 (FourCC: 0x57564331 "WVC1": VC-1) | + Default duration: 41.708ms (23.976 frames/fields per second for a video track) | + Video track | + Pixel width: 1920 | + Pixel height: 1080 | + Display width: 1920 | + Display height: 1080 | + A track | + Track number: 2 (track ID for mkvmerge & mkvextract: 1) | + Track UID: 2 | + Track type: audio | + Codec ID: A_AC3 | + Default duration: 32.000ms (31.250 frames/fields per second for a video track) | + Name: Surround 5.1 | + Audio track | + Sampling frequency: 48000 | + Channels: 6 | + A track | + Track number: 3 (track ID for mkvmerge & mkvextract: 2) | + Track UID: 4 | + Track type: subtitles | + Default flag: 0 | + Lacing flag: 0 | + Codec ID: S_HDMV/PGS | + Content encodings | + Content encoding | + Content compression

I tried mkvmerge -o full.mkv intro.mkv + film.mkv but that gives me

Error: The file no. 0 ('intro.mkv') does not contain a track with
the ID 2, or that track is not to be copied. Therefore no track
can be appended to it. The argument for '--append-to' was invalid.

It's not clear to me from the man page for mkvmerge how to specify to --append-to that the intro track should just not have subtitles and the timecodes for the film subtitles can just be shifted. Is that beyond the capability of mkvmerge?

Perhaps I need to be looking into some other tool like ffmpeg to concatenate the audio/video from mkvextract and then some other tool to manipulate the PGS subs and them mkvmerge them all together again?

Am I going to run into further problems because the audio/video differ between the two files as well (e.g. stereo vs 5.1)?

Thanks

1 Answer 1

1

Your problems are caused because the two videos are fully different, not (just) because of the subs.

How to concatenate MKVs with different tracks

The quick answer is uncompress your audio tracks (to say, WAV), mux them (stitch them together) and then compress the audio (to say, AC3)

The best way to do this is to convert the soundtrack to uncompressed WAV, (to prevent out-of-sync), separately for each MKV-file. Then concantenate and then recode them but don't recode the video stream, just the audiostream to a compressed format (MP3, AAC or AC3)

The above in steps:
1. Blow up the audio for each file, to an uncompressed format
2. Stitch them together.
3. Recode only audio to a compressed status

After 2, you should check if your audio is really sync.

You can do all of this with VirtualDub, or AviDemux 2.6.12 (set Video Output to copy), these are free and not malware.

Perhaps I need to be looking into some other tool like ffmpeg to concatenate the audio/video from mkvextract and then some other tool to manipulate the PGS subs and them mkvmerge them all together again?

If you don't have denominational issues with Windows, rather than Linux, you could also convert your subs to ".SRT" format, and use that. I'm inclined to think it's easier to work with a text based format, than with a picture based format. Up to you.

Am I going to run into further problems because the audio/video differ between the two files as well (e.g. stereo vs 5.1)?

In general, YES! The 2 audio tracks should have as identical characteristics as possible, so both stereo, this is the easiest because it's the most universal. Don't use 5.1, unless you are in a theater.

Your videos should be the same width and heigth, so either 1920 x 1080 or 720 x 480 My advice is to edit the shorter intro video. You can choose between:
- adding a border (but, it will be a tiny image)
- increase the width x height to 1920 x 1080 (but, it will be grainy)
- do both, half way, to split the difference. In your case this means:
a. increase the width x height to 1440 x 640
b. add a border of 240 - (1920-1440)/2 - left and right and a border of 220 - (1080-640)/2 to top and bottom.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .