I’m trying to convert .ts file to mp4 file using nodejs. I find there is a library https://github.com/RReverser/mpegts. I follow the guide to install the package and run
npm i -g mpegts_to_mp4
mpegts_to_mp4 src.ts dest.mp4
.
But I see the following error
RangeError: Offsets are out of bounds.
at jDataView._checkBounds (/Users/me/.nvm/versions/node/v20.15.0/lib/node_modules/mpegts_to_mp4/node_modules/jdataview/dist/node/jdataview.js:116:104)
at jDataView._getBytes (/Users/me/.nvm/versions/node/v20.15.0/lib/node_modules/mpegts_to_mp4/node_modules/jdataview/dist/node/jdataview.js:137:74)
at jDataView._getBitRangeData (/Users/me/.nvm/versions/node/v20.15.0/lib/node_modules/mpegts_to_mp4/node_modules/jdataview/dist/node/jdataview.js:242:176)
at jDataView.getUnsigned (/Users/me/.nvm/versions/node/v20.15.0/lib/node_modules/mpegts_to_mp4/node_modules/jdataview/dist/node/jdataview.js:256:30)
at Object.read (/Users/me/.nvm/versions/node/v20.15.0/lib/node_modules/mpegts_to_mp4/node_modules/jbinary/dist/node/jbinary.js:284:30)
at jBinary.<anonymous> (/Users/me/.nvm/versions/node/v20.15.0/lib/node_modules/mpegts_to_mp4/node_modules/jbinary/dist/node/jbinary.js:226:25)
at jBinary.<anonymous> (/Users/me/.nvm/versions/node/v20.15.0/lib/node_modules/mpegts_to_mp4/node_modules/jbinary/dist/node/jbinary.js:220:34)
at proto._action (/Users/me/.nvm/versions/node/v20.15.0/lib/node_modules/mpegts_to_mp4/node_modules/jbinary/dist/node/jbinary.js:222:79)
at proto.read (/Users/me/.nvm/versions/node/v20.15.0/lib/node_modules/mpegts_to_mp4/node_modules/jbinary/dist/node/jbinary.js:225:21)
at Object.read (/Users/me/.nvm/versions/node/v20.15.0/lib/node_modules/mpegts_to_mp4/mpegts_to_mp4/h264.js:23:44)
Is there anyone know why this library is not working and how to solve it?
I tried to uninstall and reinstall library but didn’t work