[Home]Container Formats/Mkv

Showing revision 24


The .mkv or Matroska container format supports the inclusion of video, audio, subtitles, fonts, still images, timecodes, and god only knows what else. It is a regular garbage pail. I am surprised nobody has figured out how to embed a trojan in the thing yet.

Wikipedia Article



THIS IS WRONG!! IT ONLY JUST HAPPENED TO WORK ON ONE SOURCE! - It's *POSSIBLE* that doin the same thing but with -ofps 120 would work .mkv containers support Variable Frame Rate video through the use of a timecodes stream containing individual frame durations (often of dubious accuracy).
Transcode can do nothing with a vfr .mkv file without some preprocessing.
The only known preprocessing step that will yield proper A/V sync is this one using mencoder:

 mencoder -oac pcm \
          -ovc copy \
          -ofps 30000/1001 \
          -o $file.avi \

This will produce a [.avi] file with properly synchronised audio and video. Any cloned frames required will simply be clones of the preceding frame, so not as nice as if you were able to make use of Transcode's modfps filter, but modfps will not handle the vfr correctly yet, so you will have to live with the slight jerkiness produced by the simple cloning.

If the source .mkv contained a subtitle stream that you want to use, extract it as in this example:

 mkvextract tracks $file.mkv 3:$file.ass

Then you can use Transcode's mplayer import module to hardsub:

 -x mplayer="-sub $file.ass -subpos 85",mplayer

You may need to use other options, including hints about the geometry of the source video stream if it is something that tcprobe doesn't know about (like h264). This command will actually produce a [.m2v] and [.ac3] file which can be mplex'd into a [.mpg] file suitable for use in creating an NTSC DVD:

 transcode --nice 20 \
           --print_status 500 \
           -x mplayer="-sub $file.ass -subpos 85",mplayer \
           -G 0.9 \
           -w 4000 \
           -H 0 \
           -g 704x480 \
           --import_asr 3 \
           -f 29.970,4 \
           -n 0x1 \
           -y ffmpeg \
           -F mpeg2video \
           -b 192 \
           -j -16,-36,-16,-36 \
           --export_asr 3 \
           --export_prof dvd-ntsc \
           -Z 720x480,fast \
           -o $file \
           -m $file.ac3 \
           -i $file.avi

The options shown in red are the hinting options needed when tcprobe fails. Note that the ",fast" in the -Z option is required in order for the resizing calculations to work when dealing with h264 source, but I have NO idea why.

See the Transcode Command Line Options page for explanations of the individual options.

Transcode Wiki | Container Formats | Recent Changes | Preferences
Password required to edit | View other revisions | View current revision
Edited June 13, 2008 6:21 pm by tarazed.ligo.caltech.edu (diff)