drift-meter/producer.mjs

29 lines
576 B
JavaScript

import {
getStream,
indexOf,
renderAllProps,
getStreamIndex,
formatDuration,
} from "./util.mjs";
import { makeIDGen } from "./util.mjs";
const makeId = makeIDGen(1);
const producerIndexGen = makeIDGen(0);
export default class Producer {
constructor(path) {
this.path = path;
this.index = producerIndexGen.next().value;
}
async toXML(fps) {
const xml = (
await $`melt ${
this.path
} -consumer xml ${`frame_rate_num=${fps}`} | htmlq producer`
).stdout;
return xml.replace("producer0", `producer${this.index}`);
}
}