fix(hikvision): PS转MP4不指定-f与bsf,由ffmpeg自动检测容器与编码

This commit is contained in:
liufumingren 2026-08-24 02:20:43 +08:00
parent fff6a2f46b
commit 5bb8c30e12

View File

@ -508,8 +508,8 @@ class HikvisionService extends BaseService {
return false;
}
};
// PS → MP4 纯复制(视频流 copy,丢弃音频),不指定 -f 让 ffmpeg 自动检测
transcoded = await ffRun(`-i "${workFile}" -c:v copy -bsf:v h264_mp4toannexb -an "${mp4Path}"`, 60000);
// PS → MP4 纯复制(视频流 copy,丢弃音频),不指定 -f 和 bsf 让 ffmpeg 自动处理
transcoded = await ffRun(`-i "${workFile}" -c:v copy -an "${mp4Path}"`, 60000);
// copy 失败直接保留 PS 原文件,不再使用 libx264 重编码(多 worker 时 CPU 不可接受)
if (transcoded) {
const mp4Size = fs.statSync(mp4Path).size;