Lines 1913-1953javascript
1913 const rel = path.join("frames", `${slug}.png`);
1914 const target = path.join(input.dir, rel);
1915 if (existsSync(target) && !input.refetch) {
1916 out.set(index, rel);
1919 // Sample the scene midpoint, clamped inside the clip.
1920 const mid = scene.start + Math.max(0, scene.duration) / 2;
1921 const seek = Number.isFinite(mid) && mid > 0 ? mid : Math.max(0, scene.start);
1922 const result = spawnSync(ffmpeg, ["-y", "-ss", seek.toFixed(3), "-i", videoPath, "-frames:v", "1", "-q:v", "3", target], { stdio: "ignore" });
1923 if (result.status === 0 && existsSync(target)) {
1924 out.set(index, rel);
1927 console.log(`[vidfarm] extracted ${out.size}/${input.scenes.length} scene frames from ${input.videoName}`);
1930async function resolveFfmpegPath() {
1931 // ffmpeg-static is already a dependency; import lazily so the common path
1932 // (no frame extraction) never pays for it, and degrade gracefully if absent.
1934 const mod = (await import("ffmpeg-static"));
1935 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 · L1933 1936 return typeof resolved === "string" && resolved.length > 0 && existsSync(resolved) ? resolved : null;
1942function safeSize(target) {
1944 return statSync(target).size;
1950// Guess a content type from a file name so My Files stores text docs as text/*
1951// (a bare multipart Blob otherwise defaults to application/octet-stream, which
1952// makes browsers download .md/.txt instead of showing them). Mirrors the common
1953// cases of the server's inferAttachmentContentType; returns "" when unknown so