I’m working with MKVToolNix GUI and noticed that in the mtxcfg configuration files, an objectID is automatically generated for each track. I need to replicate this process programmatically or understand the exact method/formula used to create these objectID values.
For example, when you add tracks in the GUI and save the settings to an mtxcfg file, each track gets a unique objectID. Does anyone know the algorithm or formula behind how these IDs are calculated? Is it based on a hash, timestamp, random generation, or something else?
I’d appreciate any insights, code snippets, or references to the source code if it’s open-source. Thanks in advance!
How those IDs are generated doesn’t matter. There are two sets of them: one for files, one for tracks. As long as they’re integers & unique across all elements in their respective category in the config file, they’re fine. At the moment they’re solely used for specifying which track from which source file is appended to what track from what source file.
Thanks for the previous response about objectID values in MKVToolNix GUI’s mtxcfg files! I understand that there are two sets of objectIDs (one for files and one for tracks), and they just need to be unique integers within their respective categories to link tracks and files for appending.
To follow up: Could someone clarify how MKVToolNix GUI generates these unique objectID values? Is there a specific algorithm or method (e.g., sequential integers, random generation, or something else) used to ensure uniqueness for tracks and files? Additionally, when working with mtxcfg files programmatically, how can I reliably identify or validate these objectIDs to ensure they’re unique within their category? For example, are there specific patterns or rules I should look for when parsing the file?
Any insights into the generation process, validation techniques, or references to relevant code/documentation would be super helpful. Thanks again!
When generating, just make sure that any number you’ve already assigned isn’t assigned again. Doesn’t matter how you generate them. You can use sequential numbers (0, 1, 2, …), you can use the default random number generator & track which numbers have already been generated, you can do whatever. The actual values inside the .mtxcfg files are discarded after having loaded them fully. They’re simply not relevant afterwards.
MKVToolNix itself simply uses the raw pointers of the memory location where the tracks & files were stored in memory when the file was saved. There’s no special algorithm at all.
As for validation, there’s only the validation that the referenced IDs for appending actually refer to assigned IDs in the same file.
Thank you for the detailed explanations about objectID values in MKVToolNix GUI’s mtxcfg files! I have a follow-up question regarding another variable in these files: container_type. Could someone clarify how the values for container_type are determined or assigned? For example, are these values predefined based on the type of media container (e.g., MKV, MP4, etc.), or are they derived from some other source within the program? If there’s a list of possible container_type values, where can I find it, or how are they generated?
Any insights, references to documentation, or examples from the mtxcfg file structure would be very helpful. Thanks again for your support!