2

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?

llogan
  • 87,794
  • 21
  • 166
  • 190
Parth Shah
  • 45
  • 4

2 Answers2

2

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.

Vincent
  • 618
  • 3
  • 9
-1

You can use ffprobe to get duration of .mkv file :

$ ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 input.mkv
5012.640000

See : https://trac.ffmpeg.org/wiki/FFprobeTips#Duration

Calumah
  • 1,865
  • 17
  • 25
  • 1
    Although your answer will properly show the duration, the question is about how to manually change the duration. – llogan May 14 '18 at 18:27
  • For your information, question title before editing was : "Parse mkv file to get duration" .... – Calumah May 19 '20 at 07:13