3 Star 0 Fork 0

mirrors_zhuker/checkcontainer

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
index.ts 1.18 KB
一键复制 编辑 原始数据 按行查看 历史
Alex Zhukov 提交于 2021-11-15 14:13 . Initial commit
import * as fs from "fs"
import * as proc from "process"
import * as rxjs from "rxjs"
import {fromEvent, mergeMap, map, Observable, groupBy, filter, bufferCount} from "rxjs"
import * as assert from "assert";
if (proc.argv.length < 3) {
console.log("usage: checkcontainer ffprobe.json")
proc.exit(1);
}
interface FfPacket {
codec_type: string,
stream_index: number,
pts: number,
pts_time: number,
dts: number,
dts_time: number,
duration: number,
duration_time: number,
size: number,
pos: number,
flags: string
}
interface Ffprobe {
packets: FfPacket[]
}
let buffer = fs.readFileSync(proc.argv[2], 'utf8');
let ffp: Ffprobe = JSON.parse(buffer)
console.log(ffp.packets.length)
rxjs.from(ffp.packets).pipe(
groupBy(p => p.codec_type + "_" + p.stream_index),
mergeMap(group => group.pipe(
bufferCount(2, 1),
filter(b => b.length == 2)
))
).subscribe(x => {
let [prev, curr] = x;
let k = prev.codec_type;
// console.log(x)
let expected = prev.pts + prev.duration;
let actual = curr.pts;
if (expected != actual) {
console.error(`${k} pts jump ${prev.pts} + ${prev.duration} != ${curr.pts} (expected ${prev.pts + prev.duration}) `)
}
})
// fs.readSync()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors_zhuker/checkcontainer.git
git@gitee.com:mirrors_zhuker/checkcontainer.git
mirrors_zhuker
checkcontainer
checkcontainer
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385