Lines 1920-1960javascript
1920 const rel = path.join("frames", `${slug}.png`);
1921 const target = path.join(input.dir, rel);
1922 if (existsSync(target) && !input.refetch) {
1923 out.set(index, rel);
1926 // Sample the scene midpoint, clamped inside the clip.
1927 const mid = scene.start + Math.max(0, scene.duration) / 2;
1928 const seek = Number.isFinite(mid) && mid > 0 ? mid : Math.max(0, scene.start);
1929 const result = spawnSync(ffmpeg, ["-y", "-ss", seek.toFixed(3), "-i", videoPath, "-frames:v", "1", "-q:v", "3", target], { stdio: "ignore" });
1930 if (result.status === 0 && existsSync(target)) {
1931 out.set(index, rel);
1934 console.log(`[vidfarm] extracted ${out.size}/${input.scenes.length} scene frames from ${input.videoName}`);
1937async function resolveFfmpegPath() {
1938 // ffmpeg-static is already a dependency; import lazily so the common path
1939 // (no frame extraction) never pays for it, and degrade gracefully if absent.
1941 const mod = (await import("ffmpeg-static"));
1942 const resolved = typeof mod === "string" ? mod : mod.default;
HighCopied Package Dependency Bridge
Package metadata claims a different repository identity while copied source loads a runtime dependency bridge.
dist/src/cli.jsView on unpkg · L1940 1943 return typeof resolved === "string" && resolved.length > 0 && existsSync(resolved) ? resolved : null;
1949function safeSize(target) {
1951 return statSync(target).size;
1957// Guess a content type from a file name so My Files stores text docs as text/*
1958// (a bare multipart Blob otherwise defaults to application/octet-stream, which
1959// makes browsers download .md/.txt instead of showing them). Mirrors the common
1960// cases of the server's inferAttachmentContentType; returns "" when unknown so