Search code examples
mkvmatroska

How to manually change duration field in matroska/mkv


I have one mkv file that doesn't have valid duration. I want to change this duration parameter manually. I gone through this matroska specification defined at http://www.matroska.org/technical/specs/index.html

Looking at specification for matroska this contains only identification magic numbers, but this doesn't specify length for data.

How to parse this matroska header so that i get duration field and change this field?


Solution

  • The type of the Duration field is float. According to the documentation it can be either 4 or 8 octets. To know which size it is, you have to look at the data size part of the field. The data size part uses an UTF-8 like system. It's explained here.