User Tools

Site Tools


header_com

How to remove header compression

If you receive a message that the “File format is not supported” when playing back a .mkv file, it may be because the file was created with header compression, which prevents playback on devices that do not support that feature. Unfortunately, the list of such devices is long.

Serviio can attempt to transcode these files into a different, playable format (if profile.xml has mkvHeaderCompressed=“true” in the appropriate Matches element), but transcoding degrades the quality. Instead of relying on Serviio to transcode the file upon playback, you should remux the file, creating a new one that has the same video and audio data, just without the compression.

You can use MediaInfo to verify whether there is header compression. To remove the compression, you can use mkvmerge.

About remuxing

Remuxing does not re-encode the video or audio data, it just recombines and reorganizes the existing digital information, changing only the way it is arranged in the file. The bits and bytes that make up the video and audio parts of the file are not changed and therefore are not degraded in any way; the quality of the remuxed file is identical to the original.

The demuxing/remuxing process takes less than 30 seconds of computer time per Gigabyte (depending on the speed of your computer). Only slightly longer than the amount of time it takes to make a copy of the original video file.

Requirements

You need to download and install MKVToolNix from http://www.bunkus.org/videotools/mkvtoolnix/

This will give you several tools for manipulating MKV files. You'll only be using mkvmerge, which, despite its name, can be used for more than just merging.

GUI method

Run the mkvmerge GUI (mmg or mmg.exe).

Add the MKV file by Drag 'n Dropping into the “Input files” section or by using the “add” button.

All video, audio, subtitles (subtitles are actually video tracks), and any other track that will allow “Compression” to be changed, must be changed to “none” to insure that the video will play properly.

  1. Open the “Extra options” tab.
  2. Highlight each Track.
  3. Change the “Compression” dropdown to “none”, if possible. Some tracks do not use this setting and will not allow it to be changed.
  4. Repeat steps 2 & 3 until all tracks are set to “none”.
  5. In the “Output Location” box enter the path and file name for the final MKV file, use the browse button to save to a different folder or use the default location and file name (do not attempt to overwrite the original file).
  6. Click “Start muxing” to remux and save the new MKV file.

When muxing completes, close mkvMerge and play the file with your favorite media player or standalone device. The original file may be deleted when the new file is tested and deemed proper.

Command-line method

Each track in the MKV has a numeric ID starting at 0. Assuming the filename of the MKV is “input.mkv”, you can get a list of IDs like this:

mkvmerge -i input.mkv

or

mkvmerge --identify input.mkv

The output will look something like this:

File 'input.mkv': container: Matroska
Track ID 0: video (V_MPEG4/ISO/AVC)
Track ID 1: audio (A_AC3)

Then you can use those IDs in the –compression options in the command line. Add “–compression ID:none” option for each ID. For example, if there are 2 IDs (0 and 1), you would do this:

mkvmerge --compression 0:none --compression 1:none --clusters-in-meta-seek -o output.mkv input.mkv

That's all there is to it. The output file, output.mkv (or whatever you named it) should be playable.

The –clusters-in-meta-seek option is not related to compression; it just helps make the file seekable on some players.

Further reading

header_com.txt · Last modified: 2013/01/21 18:28 by slaute