@reshotdev/screenshot 0.0.1-beta.1 → 0.0.1-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reshotdev/screenshot",
3
- "version": "0.0.1-beta.1",
3
+ "version": "0.0.1-beta.4",
4
4
  "description": "CI/CD screenshot and video capture CLI",
5
5
  "author": "Reshot <hello@reshot.dev>",
6
6
  "license": "MIT",
@@ -1931,12 +1931,17 @@ async function runScenarioWithVideoCapture(scenario, options = {}) {
1931
1931
 
1932
1932
  await fs.writeFile(sentinelPath, buffer);
1933
1933
  sentinelPaths.push({ index: sentinelIndex, label, path: sentinelPath });
1934
+ if (firstSentinelTimestamp === null) {
1935
+ firstSentinelTimestamp = (Date.now() - startTime) / 1000;
1936
+ debug(`First sentinel captured at ${firstSentinelTimestamp.toFixed(2)}s`);
1937
+ }
1934
1938
  sentinelIndex++;
1935
1939
  return sentinelPath;
1936
1940
  }
1937
1941
 
1938
1942
  // Capture initial state BEFORE first navigation (placeholder - actual capture after goto)
1939
1943
  let hasNavigated = false;
1944
+ let firstSentinelTimestamp = null;
1940
1945
 
1941
1946
  // Execute all steps and capture timeline
1942
1947
  for (let stepIndex = 0; stepIndex < script.length; stepIndex++) {
@@ -2292,20 +2297,32 @@ async function runScenarioWithVideoCapture(scenario, options = {}) {
2292
2297
  )
2293
2298
  );
2294
2299
 
2295
- // Convert to MP4 with ffmpeg, trimming to actual content duration
2296
- // Add a small buffer (0.5s) after the final action
2297
- const trimDuration = finalTimestamp + 0.5;
2298
- console.log(
2299
- chalk.cyan(
2300
- ` šŸ“¹ Converting to MP4 (trimmed to ${trimDuration.toFixed(1)}s)...`
2301
- )
2302
- );
2303
- debug(`Running ffmpeg conversion with trim to ${trimDuration}s...`);
2300
+ // Convert to MP4 with ffmpeg, trimming blank loading frames from start
2301
+ // and excess frames from end
2302
+ const startOffset = Math.max(0, (firstSentinelTimestamp || 0) - 0.3);
2303
+ const endTimestamp = finalTimestamp + 0.5;
2304
+ const contentDuration = endTimestamp - startOffset;
2305
+ if (startOffset > 0) {
2306
+ console.log(
2307
+ chalk.cyan(
2308
+ ` šŸ“¹ Converting to MP4 (${startOffset.toFixed(1)}s–${endTimestamp.toFixed(1)}s, ${contentDuration.toFixed(1)}s content)...`
2309
+ )
2310
+ );
2311
+ } else {
2312
+ console.log(
2313
+ chalk.cyan(
2314
+ ` šŸ“¹ Converting to MP4 (trimmed to ${contentDuration.toFixed(1)}s)...`
2315
+ )
2316
+ );
2317
+ }
2318
+ debug(`Running ffmpeg: start=${startOffset}s, duration=${contentDuration}s`);
2304
2319
  await runFFmpegConvert([
2320
+ "-ss",
2321
+ startOffset.toFixed(2),
2305
2322
  "-i",
2306
2323
  recordedVideoPath,
2307
2324
  "-t",
2308
- trimDuration.toFixed(2),
2325
+ contentDuration.toFixed(2),
2309
2326
  "-c:v",
2310
2327
  "libx264",
2311
2328
  "-preset",