GithubHelp home page GithubHelp logo

mediainfo's People

Contributors

m-rots avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

mediainfo's Issues

Feature request: HTML output

Hello and thanks for this great module!
Could you please consider switching from JSON to HTML output? Seems to work on a quick peek lik that, changes in dist/index.js:

			//MI.Option('Output', 'JSON');
                            MI.Option('Output', 'HTML');
                            MI.Option('Complete');
                            //var output = JSON.parse(MI.Inform());
			var output = MI.Inform();

Crash

Hi,
when analyzing files with e.g. 0kb or files that Mediainfo dont support like a json fie, i am getting a crash of my module which i cannot even catch by using try/catch.. Thats bad because my webserver should always be running...

RangeError [ERR_OUT_OF_RANGE]: The value of "start" is out of range. It must be >= 0 and <= 2 ** 53 - 1. Received -1
at checkPosition (internal/fs/streams.js:45:11)
at new ReadStream (internal/fs/streams.js:83:5)
at Object.createReadStream (fs.js:1802:10)
at ReadStream. (C:\dev\ffastrans_webui\rest_service\node_modules\node-mediainfo\dist\index.js:84:50)

I was able to workaround by using this code in line 82 in index.js - this way i get some result from mediainfo and if it is just the file size then so be it... all better than a crash that i cannot catch...

if (seekTo < 0){
 seekTo = 0;
}

Now i fear that there could be more issues that cause a crash of my application, any idea how i can catch an error thats thrown in the wasm?

Support streams as input

Could you support a readable stream as input? Looking at src/index.ts it seems like it would be trivial, since you're already loading the local file as a stream. I would happily submit a PR but TypeScript is still a mystery to me ๐Ÿ˜…

Having another look at the code, it looks like you need to close the stream and then reopen it. Not sure how you could do that if we pass in the stream as an argument. perhaps it's not necessary to close it?

Some unexpected errors

Hi,

I've just started migrating to this library and encountered some errors while processing files with it, not sure if these are bugs within medainfo itself, or this version of it.

Let me know if there are any additional details that may be needed or if I can assist in tracking these down.

RuntimeError: float unrepresentable in integer range
    at wasm-function[4084]:107
    at wasm-function[3442]:5
    at wasm-function[3440]:1155
    at wasm-function[3427]:838
    at wasm-function[3999]:117
    at wasm-function[3996]:413
    at wasm-function[3993]:263
    at wasm-function[3992]:669
    at wasm-function[4003]:1880
    at wasm-function[989]:79
    at wasm-function[1625]:494
    at wasm-function[1626]:1515
    at wasm-function[1597]:23398
    at wasm-function[3999]:117
    at wasm-function[3996]:413
    at wasm-function[3993]:263
    at wasm-function[3992]:669
    at wasm-function[4207]:161
    at wasm-function[3993]:124
    at wasm-function[3992]:669
    at wasm-function[410]:494
    at wasm-function[53]:66
/edacis/node_modules/node-mediainfo/lib/MediaInfoWasm.js:19
function(a){if(!(a instanceof x))throw a;});c.inspect=function(){return"[Emscripten Module object]"}}else if(ca)c.print||(c.print=print),"undefined"!=typeof printErr&&(c.printErr=printErr),c.read="undefined"!=typeof read?read:function(){throw"no read() available";},c.readBinary=function(a){if("function"===typeof readbuffer)return new Uint8Array(readbuffer(a));a=read(a,"binary");assert("object"===typeof a);return a},"undefined"!=typeof scriptArgs?c.arguments=scriptArgs:"undefined"!=typeof arguments&&
                                 ^

RuntimeError: float unrepresentable in integer range
    at wasm-function[4084]:107
    at wasm-function[3442]:5
    at wasm-function[3440]:1155
    at wasm-function[3427]:838
    at wasm-function[3999]:117
    at wasm-function[3996]:413
    at wasm-function[3993]:263
    at wasm-function[3992]:669
    at wasm-function[4003]:1880
    at wasm-function[989]:79
    at wasm-function[1625]:494
    at wasm-function[1626]:1515
    at wasm-function[1597]:23398
    at wasm-function[3999]:117
    at wasm-function[3996]:413
    at wasm-function[3993]:263
    at wasm-function[3992]:669
    at wasm-function[4207]:161
    at wasm-function[3993]:124
    at wasm-function[3992]:669
    at wasm-function[410]:494
    at wasm-function[53]:66
Cannot enlarge memory arrays. Either (1) compile with  -s TOTAL_MEMORY=X  with X higher than the current value 134217728, (2) compile with  -s ALLOW_MEMORY_GROWTH=1  which allows increasing the size at runtime, or (3) if you want malloc to return NULL (0) instead of this abort, compile with  -s ABORTING_MALLOC=0 
Cannot enlarge memory arrays. Either (1) compile with  -s TOTAL_MEMORY=X  with X higher than the current value 134217728, (2) compile with  -s ALLOW_MEMORY_GROWTH=1  which allows increasing the size at runtime, or (3) if you want malloc to return NULL (0) instead of this abort, compile with  -s ABORTING_MALLOC=0 
abort("Cannot enlarge memory arrays. Either (1) compile with  -s TOTAL_MEMORY=X  with X higher than the current value 134217728, (2) compile with  -s ALLOW_MEMORY_GROWTH=1  which allows increasing the size at runtime, or (3) if you want malloc to return NULL (0) instead of this abort, compile with  -s ABORTING_MALLOC=0 ") at Error
    at Ea (/edacis/node_modules/node-mediainfo/lib/MediaInfoWasm.js:41:26)
    at E (/edacis/node_modules/node-mediainfo/lib/MediaInfoWasm.js:142:128)
    at ga (/edacis/node_modules/node-mediainfo/lib/MediaInfoWasm.js:43:15)
    at enlargeMemory (/edacis/node_modules/node-mediainfo/lib/MediaInfoWasm.js:96:53)
    at wasm-function[5528]:67
    at wasm-function[4963]:3289
    at wasm-function[5448]:16
    at wasm-function[5449]:3
    at wasm-function[3992]:203
    at wasm-function[410]:494
    at wasm-function[53]:66
    at wasm-function[109]:138
    at wasm-function[5544]:16
    at dynCall_iiii_23 (eval at X (/edacis/node_modules/node-mediainfo/lib/MediaInfoWasm.js:83:483), <anonymous>:4:12)
    at MediaInfo$Open_Buffer_Continue [as Open_Buffer_Continue] (eval at Gc (/edacis/node_modules/node-mediainfo/lib/MediaInfoWasm.js:90:433), <anonymous>:9:10)
    at ReadStream.<anonymous> (/edacis/node_modules/node-mediainfo/dist/index.js:86:36)
    at ReadStream.emit (events.js:189:13)
    at ReadStream.EventEmitter.emit (domain.js:441:20)
    at addChunk (_stream_readable.js:284:12)
    at readableAddChunk (_stream_readable.js:265:11)
    at ReadStream.Readable.push (_stream_readable.js:220:10)
    at lazyFs.read (internal/fs/streams.js:181:12)
If this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.

/edacis/node_modules/node-mediainfo/lib/MediaInfoWasm.js:19
function(a){if(!(a instanceof x))throw a;});c.inspect=function(){return"[Emscripten Module object]"}}else if(ca)c.print||(c.print=print),"undefined"!=typeof printErr&&(c.printErr=printErr),c.read="undefined"!=typeof read?read:function(){throw"no read() available";},c.readBinary=function(a){if("function"===typeof readbuffer)return new Uint8Array(readbuffer(a));a=read(a,"binary");assert("object"===typeof a);return a},"undefined"!=typeof scriptArgs?c.arguments=scriptArgs:"undefined"!=typeof arguments&&
                                 ^
abort("Cannot enlarge memory arrays. Either (1) compile with  -s TOTAL_MEMORY=X  with X higher than the current value 134217728, (2) compile with  -s ALLOW_MEMORY_GROWTH=1  which allows increasing the size at runtime, or (3) if you want malloc to return NULL (0) instead of this abort, compile with  -s ABORTING_MALLOC=0 ") at Error
    at Ea (/edacis/node_modules/node-mediainfo/lib/MediaInfoWasm.js:41:26)
    at E (/edacis/node_modules/node-mediainfo/lib/MediaInfoWasm.js:142:128)
    at ga (/edacis/node_modules/node-mediainfo/lib/MediaInfoWasm.js:43:15)
    at enlargeMemory (/edacis/node_modules/node-mediainfo/lib/MediaInfoWasm.js:96:53)
    at wasm-function[5528]:67
    at wasm-function[4963]:3289
    at wasm-function[5448]:16
    at wasm-function[5449]:3
    at wasm-function[3992]:203
    at wasm-function[410]:494
    at wasm-function[53]:66
    at wasm-function[109]:138
    at wasm-function[5544]:16
    at dynCall_iiii_23 (eval at X (/edacis/node_modules/node-mediainfo/lib/MediaInfoWasm.js:83:483), <anonymous>:4:12)
    at MediaInfo$Open_Buffer_Continue [as Open_Buffer_Continue] (eval at Gc (/edacis/node_modules/node-mediainfo/lib/MediaInfoWasm.js:90:433), <anonymous>:9:10)
    at ReadStream.<anonymous> (/edacis/node_modules/node-mediainfo/dist/index.js:86:36)
    at ReadStream.emit (events.js:189:13)
    at ReadStream.EventEmitter.emit (domain.js:441:20)
    at addChunk (_stream_readable.js:284:12)
    at readableAddChunk (_stream_readable.js:265:11)
    at ReadStream.Readable.push (_stream_readable.js:220:10)
    at lazyFs.read (internal/fs/streams.js:181:12)
If this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.

Advanced output

Hey :-) I had some play but didnt get it to work: is there any chance to get the "Advanced" output (-f on mediainfo commandline)?

Another crash - ALLOW_MEMORY_GROWTH

Hey,
i am not sure why this is happening only when i compile my code using nexe into the 32bit binary but anyway, i wanted to post the result.
So, when analyzing a file larger than 2GB using your module in some code that was compiled using nexe to 32bit, the application crashes with the following error message which should imho be solved at compile time of the wasm module.
Not sure if you compile the wasm or you just take a precompiled from Jerome@Mediainfo?


function(a){if(!(a instanceof x))throw a;});c.inspect=function(){return"[Emscripten Module object]"}}else if(ca)c.print||(c.print=print),"undefined"!=typeof printErr&&(c.printErr=printErr),c.read="undefined"!=typeof read?read:function(){throw"no read() available";},c.readBinary=function(a){if("function"===typeof readbuffer)return new Uint8Array(readbuffer(a));a=read(a,"binary");assert("object"===typeof a);return a},"undefined"!=typeof scriptArgs?c.arguments=scriptArgs:"undefined"!=typeof arguments&&
                                 ^
abort("Cannot enlarge memory arrays. Either (1) compile with  -s TOTAL_MEMORY=X  with X higher than the current value 134217728, (2) compile with  -s ALLOW_MEMORY_GROWTH=1  which allows increasing the size at runtime, or (3) if you want malloc to return NULL (0) instead of this abort, compile with  -s ABORTING_MALLOC=0 ") at Error
    at Ea (C:\dev\ffastrans_webui\rest_service\node_modules\node-mediainfo\lib\MediaInfoWasm.js:41:26)
    at E (C:\dev\ffastrans_webui\rest_service\node_modules\node-mediainfo\lib\MediaInfoWasm.js:142:128)
    at ga (C:\dev\ffastrans_webui\rest_service\node_modules\node-mediainfo\lib\MediaInfoWasm.js:43:15)
    at enlargeMemory (C:\dev\ffastrans_webui\rest_service\node_modules\node-mediainfo\lib\MediaInfoWasm.js:96:53)
    at wasm-function[5577]:67
    at wasm-function[4999]:3289
    at wasm-function[5497]:16
    at wasm-function[5498]:3
    at wasm-function[4025]:203
    at wasm-function[413]:494
    at wasm-function[53]:66
    at wasm-function[109]:138
    at wasm-function[5593]:16
    at dynCall_iiii_23 (eval at X (C:\dev\ffastrans_webui\rest_service\node_modules\node-mediainfo\lib\MediaInfoWasm.js:83:483), <anonymous>:4:12)
    at MediaInfo$Open_Buffer_Continue [as Open_Buffer_Continue] (eval at Gc (C:\dev\ffastrans_webui\rest_service\node_modules\node-mediainfo\lib\MediaInfoWasm.js:90:433), <anonymous>:9:10)
    at ReadStream.<anonymous> (C:\dev\ffastrans_webui\rest_service\node_modules\node-mediainfo\dist\index.js:89:36)
If this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.

How to use in NodeJS

Thanks for this, its a great idea.
Assumed i don't want to use typescript, is there a way to still use this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.