File size: 557 Bytes
03b405b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const fs = require("node:fs");
const { probe } = require("../ffmpeg/ffprobe");
const { buildPlan } = require("../ffmpeg/planner");

async function summarizeVideo(filePath, mode = "auto") {
  const info = await probe(filePath);
  const plan = await buildPlan(info, mode);
  return {
    filePath,
    size: fs.statSync(filePath).size,
    duration: info.duration,
    resolution: `${info.width}x${info.height}`,
    fps: info.fps,
    bitrate: info.bitrate,
    selectedMode: plan.mode,
    encoder: plan.encoder
  };
}

module.exports = { summarizeVideo };