VideoHelp Forum
+ Reply to Thread
Results 1 to 2 of 2
Thread
  1. Member
    Join Date
    Aug 2023
    Location
    Sweden
    Search PM
    Hello, I am new here, I am not sure if this is the right category but I hope so!

    Anyways, I am new to programming, self taught and only in JavaScript and a little bit of Bash, so my skills are very basic. However, for reasons that I'm not gonna write multiple paragraphs about, I need to change the duration in an MKV file, and it needs to be quick. By duration I simply mean the metadata in the segment information and not changing the actual duration of the MKV movie. I can use FFMPEG and it will automatically set duration, but it's not fast enough (don't know how it works, but I don't wanna copy the entire file when all I need to do is change/add a few bytes).

    I couldn't find any tools that allows me to do this, so I thought I would have to change it myself with a hex editor. I have an MKV file with a duration already set, I know how I can change the duration there, I've done it and it works. But I need to add a duration on an MKV file that's missing it, and I don't know where exactly in the hex editor it goes, and how I can add it, that's where I need help. I believe it needs to go in the "Segment Information", which has an EBML ID of "0x1549A966". But do I just add it in there right before any EBML ID in there?

    For example, can I just add this in
    Code:
    44 89 88 40 EB A5 00 00 00 00 00
    ?

    It has a double value of 1556616, or the duration of the movie in MS. All I did was add it in right before 0x4D80 (MuxingApp EBML ID), simply hoping it would work and not really understanding all of it. Either way, it mostly didn't work.

    Using MKVInfo on the file, it shows the duration, but then this error appears:
    Warning: test.mkv: Error in the Matroska file structure at position 280. Resyncing to the next level 1 element.
    Warning: Resyncing successful at position 291.
    It doesn't show the duration of the movie in Windows either. In VLC media player, it loaded instantly, not sure if it has to do with me having played the movie right before adding the duration, or because I actually added the duration on it, but when there's not a duration set, it takes a while to start playing. But either way there's still an error in MKVInfo and it's not showing the duration in Windows, so I did something wrong. And would hope someone here can help me!

    Sorry if I added too much information, and if I added too little, tell me what more information I can come with!

    It also
    Quote Quote  
  2. you may find this useful


    Code:
    https://stackoverflow.com/questions/26687711/how-to-manually-change-duration-field-in-matroska-mkv
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!