node-matroska icon indicating copy to clipboard operation
node-matroska copied to clipboard

Error: Invalid ebmlName 'TimecodeScale'

Open nklhtv opened this issue 3 years ago • 11 comments

For me 2.2.4 fails with Error: Invalid ebmlName 'TimecodeScale' when i require it. Tried to change TimecodeScale > TimestampScale but then it fails with another Error: Invalid ebmlName

TimecodeScale existed but was removed in 2.2.4 https://github.com/oeuillot/node-matroska/pull/9/files#diff-ffadab0ba7a844f70b864530afe444d3684ca96212ca5b3e3bcd72291e535123L1822

@chrmcg Perhaps you can help me. Am i missing something?

nklhtv avatar Apr 07 '22 10:04 nklhtv

@nklhtv The corresponding hex code 0x2ad7b1 wasn't removed, just moved (from line 1821 to line 2142).

It looks like Matroska V4 renamed "timecodes" to "timestamps" across the board.

When I require 2.2.4 in my app, things seem ok -- could you post reproduction steps for the error you're seeing?

chrmcg avatar Apr 07 '22 18:04 chrmcg

@chrmcg thank you for the fast response https://github.com/nklhtv/matroska-test for me it fails with:

/home/matroska/node_modules/matroska/lib/dom/_proto.js:10
                throw new Error("Invalid ebmlName '" + ebmlName + "'");
                ^

Error: Invalid ebmlName 'TimecodeScale'
    at Object.addAttribute (/home/matroska/node_modules/matroska/lib/dom/_proto.js:10:9)
    at Object.<anonymous> (/home/matroska/node_modules/matroska/lib/dom/info.js:32:8)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/home/matroska/node_modules/matroska/lib/document.js:25:1)
    at Module._compile (internal/modules/cjs/loader.js:999:30)

nklhtv avatar Apr 07 '22 21:04 nklhtv

0x2ad7b1 has cppname of TimecodeScale while its name is TimestampScale but if i change TimecodeScale to TimestampScale in lib/dom/info.js another similar error pops up. this time about ColourSpace

nklhtv avatar Apr 07 '22 21:04 nklhtv

I'm trying to figure out what _proto.addAttribute is for in lib/dom/info.js... seems like we're looking at the same thing right now

chrmcg avatar Apr 07 '22 21:04 chrmcg

after i change ColourSpace to UncompressedFourCC and TimecodeScale to TimestampScale it seems fine, at least for the video i am testing with

nklhtv avatar Apr 07 '22 21:04 nklhtv

I think the right way to upgrade this library to Matroska V4 would be to also go through /lib/dom and add all the new attributes to the Document prototype.

For some context -- When I made https://github.com/oeuillot/node-matroska/pull/9, I was only concerned about the schema file because that's the only piece that's used by ts-ebml, the library I use to set EBML metadata on webm files generated in the browser.

chrmcg avatar Apr 07 '22 21:04 chrmcg

@oeuillot what do you think?

chrmcg avatar Apr 07 '22 21:04 chrmcg

P.S. silly question, but rather than manually translating the already machine-readable Matroska specification ebml_matroska.xml, why not create a mechanism that parses it direct from the source of truth (or a local verbatim snapshot of it)? 🤔

theipster avatar May 22 '22 01:05 theipster

I'm sorry, I'm in the middle of delivering a big project in React JS (an 18 months work). Everything must be ready by the end of the week, so I really don't have time to dedicate to node-mkv. However, at the beginning of June, I'll be able to work more actively on the project.

oeuillot avatar May 23 '22 07:05 oeuillot

Hello :) @oeuillot

any news about this ?

cyril-colin avatar Nov 30 '22 20:11 cyril-colin

P.S. silly question, but rather than manually translating the already machine-readable Matroska specification ebml_matroska.xml, why not create a mechanism that parses it direct from the source of truth (or a local verbatim snapshot of it)? 🤔

Further to this, I spent this evening quickly hacking together some code (it's ugly, sorry not sorry) to show how it could quite easily be done.

As a sense check, you can compare my autogenerated schema against the currently hardcoded lib/schema.js and it's actually not too far off - especially considering that my version uses the cutting-edge upstream spec ebml_matroska.xml, which contains changes that aren't in lib/schema.js yet.

If anyone is interested, I've pushed some code to https://github.com/oeuillot/node-matroska/pull/16.

theipster avatar May 31 '23 03:05 theipster