dsh-ffmpeg 0.7.0 → 0.7.2

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/CHANGELOG.md CHANGED
@@ -4,6 +4,16 @@
4
4
 
5
5
  [历史英文记录](docs/CHANGELOG.en.md)
6
6
 
7
+ ## 0.7.2 (2026-10-29)
8
+
9
+ - 补齐中英文使用流程:准备、入口、具体操作与结果核对;新增累计 npm 下载徽章并保留月统计。
10
+ - Add practical getting-started workflows and lifetime npm download badges alongside monthly counts.
11
+
12
+ ## 0.7.1 (2026-10-29)
13
+
14
+ - 修复极短、分数帧率视频的采样时间取整越过最后一帧:向下取微秒精度,源文件保持不变。
15
+ - Avoid rounding past the final frame when sampling short fractional-frame-rate clips.
16
+
7
17
  ## 0.7.0 (2026-10-29)
8
18
 
9
19
  - 新增 ffmpeg_storyboard:均匀采样并拼成单张 PNG 总览图,附每格采样目标时间;可指定片段范围,保留原视频与已有成品。失败或取消会清理临时采样,不发布半成品。
package/README.en.md CHANGED
@@ -6,7 +6,9 @@
6
6
 
7
7
  Use local FFmpeg from DSH to trim, join, encode and process existing media, including subtitles, audio, GIFs and frame extraction. For authoring new video projects, use the HyperFrames or Remotion plugin.
8
8
 
9
- [![npm](https://img.shields.io/npm/v/dsh-ffmpeg)](https://www.npmjs.com/package/dsh-ffmpeg) [![downloads](https://raw.githubusercontent.com/STARDUSTLC666/dsh-suite/npm-downloads/assets/dsh-ffmpeg-downloads.svg)](https://www.npmjs.com/package/dsh-ffmpeg)
9
+ [![npm](https://img.shields.io/npm/v/dsh-ffmpeg)](https://www.npmjs.com/package/dsh-ffmpeg) [![downloads](https://raw.githubusercontent.com/STARDUSTLC666/dsh-suite/npm-downloads/assets/dsh-ffmpeg-downloads.svg)](https://www.npmjs.com/package/dsh-ffmpeg) [![total downloads](https://raw.githubusercontent.com/STARDUSTLC666/dsh-suite/npm-downloads/assets/dsh-ffmpeg-total-downloads.svg)](https://www.npmjs.com/package/dsh-ffmpeg)
10
+
11
+ [Download statistics](https://github.com/STARDUSTLC666/dsh-suite/blob/npm-downloads/README.md)
10
12
 
11
13
  Feedback and contributions are welcome: report [issues](https://github.com/STARDUSTLC666/dsh-ffmpeg/issues) or submit [pull requests](https://github.com/STARDUSTLC666/dsh-ffmpeg/pulls).
12
14
 
@@ -30,7 +32,11 @@ For the web version, replace `desktop` with `web`. Restart DSH after installatio
30
32
 
31
33
  ## Start using it
32
34
 
33
- Provide an input file and ask: “Trim this video to 30 seconds and export a shareable MP4.”
35
+ 1. Install FFmpeg/ffprobe and run ffmpeg_health in DSH to check the executables.
36
+ 2. Place the input in your workspace or provide its exact local path, and describe the clip and output requirements.
37
+ 3. Use ffmpeg_storyboard to inspect a contact sheet first; locate segments using the returned cell sample times.
38
+ 4. Choose trimming, joining, encoding or extraction. Source files are protected and existing output gets a new name by default.
39
+ 5. Open the returned output, inspect it with ffmpeg_probe, and play it to check both picture and sound.
34
40
 
35
41
  ## Requirements and configuration
36
42
 
package/README.md CHANGED
@@ -6,7 +6,9 @@
6
6
 
7
7
  通过 DSH 调用本机 FFmpeg,处理已有音视频文件:裁切、拼接、转码、字幕、音轨、GIF 与帧提取。适合媒体后期处理;创作新的视频工程可选 HyperFrames 或 Remotion 插件。
8
8
 
9
- [![npm](https://img.shields.io/npm/v/dsh-ffmpeg)](https://www.npmjs.com/package/dsh-ffmpeg) [![downloads](https://raw.githubusercontent.com/STARDUSTLC666/dsh-suite/npm-downloads/assets/dsh-ffmpeg-downloads.svg)](https://www.npmjs.com/package/dsh-ffmpeg)
9
+ [![npm](https://img.shields.io/npm/v/dsh-ffmpeg)](https://www.npmjs.com/package/dsh-ffmpeg) [![downloads](https://raw.githubusercontent.com/STARDUSTLC666/dsh-suite/npm-downloads/assets/dsh-ffmpeg-downloads.svg)](https://www.npmjs.com/package/dsh-ffmpeg) [![total downloads](https://raw.githubusercontent.com/STARDUSTLC666/dsh-suite/npm-downloads/assets/dsh-ffmpeg-total-downloads.svg)](https://www.npmjs.com/package/dsh-ffmpeg)
10
+
11
+ [下载统计说明](https://github.com/STARDUSTLC666/dsh-suite/blob/npm-downloads/README.md)
10
12
 
11
13
  欢迎使用,遇到问题或有改进建议,请提交 [issues](https://github.com/STARDUSTLC666/dsh-ffmpeg/issues) 和 [PR](https://github.com/STARDUSTLC666/dsh-ffmpeg/pulls)。
12
14
 
@@ -30,7 +32,11 @@ dsh plugin --profile desktop add dsh-ffmpeg
30
32
 
31
33
  ## 开始使用
32
34
 
33
- 准备输入文件后可说:“把这段视频裁成 30 秒,并导出适合分享的 MP4。”
35
+ 1. 安装 FFmpeg/ffprobe,并在 DSH 中运行 ffmpeg_health 检查可执行文件。
36
+ 2. 把输入文件放在当前工作区或提供准确的本地路径,说明想要的片段和输出规格。
37
+ 3. 想先看内容时,让助手用 ffmpeg_storyboard 生成总览图,按每格采样时间定位片段。
38
+ 4. 选择裁切、拼接、转码或抽帧等操作;默认保留源文件,重名成品另取文件名。
39
+ 5. 按返回路径打开成品,用 ffmpeg_probe 检查参数,并实际播放核对画面和声音。
34
40
 
35
41
  ## 依赖与配置
36
42
 
package/docs/USAGE.en.md CHANGED
@@ -75,7 +75,7 @@ ffmpeg_gif { input: E:\videos\raw.mp4, duration: 3, width: 480 }
75
75
 
76
76
  ```bash
77
77
  pnpm install
78
- pnpm test # build + 120 tests
78
+ pnpm test # build + 121 tests
79
79
  ```
80
80
 
81
81
  ## License
package/docs/USAGE.md CHANGED
@@ -79,7 +79,7 @@ ffmpeg_adjust { input: E:\videos\raw.mp4, volume: +2dB }
79
79
 
80
80
  ```bash
81
81
  pnpm install
82
- pnpm test # 构建 + 120 个测试
82
+ pnpm test # 构建 + 121 个测试
83
83
  ```
84
84
 
85
85
  ## License
package/lib/storyboard.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { constants, copyFileSync, existsSync, lstatSync, mkdirSync, mkdtempSync, rmSync } from 'node:fs';
2
2
  import { tmpdir } from 'node:os';
3
3
  import { dirname, extname, join } from 'node:path';
4
- import { fmtSeconds, probeArgs } from './args.js';
4
+ import { probeArgs } from './args.js';
5
5
  import { parseTimeArg } from './config.js';
6
6
  import { parseProbeJson } from './ffprobe.js';
7
7
  import { assertInputFile, assertOutputNotSource, resolveOutputPath } from './paths.js';
@@ -79,13 +79,15 @@ export function createStoryboardTool(config, runner) {
79
79
  const lastFrame = info.video.fps && info.video.fps > 0 ? Math.max(0, duration - 1 / info.video.fps) : duration;
80
80
  if (start > lastFrame)
81
81
  throw new Error('所选范围太靠近结尾,无法取得视频帧;请提前 start。');
82
- const frames = Array.from({ length: count }, (_, i) => ({ index: i + 1, row: Math.floor(i / columns) + 1, column: i % columns + 1, seconds: Number(fmtSeconds(Math.min(lastFrame, start + (end - start) * i / count))) }));
82
+ // Round down to FFmpeg's microsecond clock. Millisecond rounding can seek
83
+ // beyond the final frame of a short fractional-frame-rate video.
84
+ const frames = Array.from({ length: count }, (_, i) => ({ index: i + 1, row: Math.floor(i / columns) + 1, column: i % columns + 1, seconds: Math.floor(Math.min(lastFrame, start + (end - start) * i / count) * 1e6) / 1e6 }));
83
85
  const scratch = mkdtempSync(join(tmpdir(), 'dsh-ffmpeg-storyboard-'));
84
86
  try {
85
87
  for (const frame of frames) {
86
88
  const image = join(scratch, 'frame-' + String(frame.index).padStart(3, '0') + '.png');
87
89
  const filter = 'scale=' + cellWidth + ':' + cellHeight + ':force_original_aspect_ratio=decrease,pad=' + cellWidth + ':' + cellHeight + ':(ow-iw)/2:(oh-ih)/2:color=black,setsar=1';
88
- await invoke([config.ffmpegPath, '-nostdin', '-v', 'error', '-n', '-ss', fmtSeconds(frame.seconds), '-i', input, '-map', '0:v:0', '-frames:v', '1', '-an', '-vf', filter, '-update', '1', image], '采样 #' + frame.index);
90
+ await invoke([config.ffmpegPath, '-nostdin', '-v', 'error', '-n', '-ss', frame.seconds.toFixed(6), '-i', input, '-map', '0:v:0', '-frames:v', '1', '-an', '-vf', filter, '-update', '1', image], '采样 #' + frame.index);
89
91
  if (!existsSync(image) || !lstatSync(image).isFile() || lstatSync(image).size === 0)
90
92
  throw new Error('无法取得第 ' + frame.index + ' 格(' + frame.seconds + ' 秒)的画面,请缩短采样范围后重试。');
91
93
  }
@@ -437,7 +437,7 @@ function __stardustUpdatesClient(ctx, React, require, shared) {
437
437
  }
438
438
 
439
439
  /* STARDUSTLC_UPDATE_CLIENT_BODY_START */
440
- window.__ModuleLoader__.load(__stardustUpdatesWrap({id:"dsh-ffmpeg",factory:require=>({apply(){}})},{"name":"dsh-ffmpeg","version":"0.1.0","hasWorkbench":false,"packageVersion":"0.7.0","label":"FFmpeg","labelEn":"FFmpeg","suiteComponent":true}));
440
+ window.__ModuleLoader__.load(__stardustUpdatesWrap({id:"dsh-ffmpeg",factory:require=>({apply(){}})},{"name":"dsh-ffmpeg","version":"0.1.0","hasWorkbench":false,"packageVersion":"0.7.2","label":"FFmpeg","labelEn":"FFmpeg","suiteComponent":true}));
441
441
 
442
442
  /* STARDUSTLC_UPDATE_CLIENT_BODY_END */
443
443
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-ffmpeg",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "description": "DSH 音视频处理:本机 FFmpeg 裁切、转码、字幕、音轨、GIF、抽帧与视频总览图。欢迎提交 issues 和 PR。",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",