Created
March 15, 2020 00:06
-
-
Save funmaker/8cfa3e62f750a7dca1bd1f2909ffc0d3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { Decoder, Encoder, tools: {readVint, writeVint, createFloatBuffer} } = require('ts-ebml'); | |
const fs = require("fs"); | |
const decoder = new Decoder(); | |
const encoder = new Encoder(); | |
const file = fs.readFileSync(process.argv[2]); | |
const data = decoder.decode(file); | |
const out = []; | |
const enc = v => v === undefined ? "undef" : v; | |
const filters = ["Seek", "unknown", "DefaultDuration", "Cue", "FlagLacing", "Language", "SimpleTag", "Tag", "Targets"]; | |
//const filters = ["Seek", "unknown"]; | |
for(const seg of data) { | |
// console.log(seg.tagStart + "\t" + seg.type + "\t" + enc(seg.isEnd) + "\t" + enc(seg.unknownSize) + "\t" + seg.name); | |
if(filters.every(f => !seg.name.includes(f))) { | |
if(seg.name === "Duration") { | |
console.log(seg.type, seg.data) | |
seg.data = Buffer.from([ 63, 128, 0, 0 ]); | |
console.log(seg.data) | |
} | |
out.push(seg); | |
} | |
} | |
const bytes = encoder.encode(out); | |
fs.writeFileSync("cursed_" + process.argv[2], Buffer.from(bytes)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment