| author | |
| committer | |
| log | d281939a47bccfd03bc3a45f38a73bb2b4ff7e5f |
| tree | 5d9cdf56a101122c952b7586328d4a00f26aeb1e |
| parent | 9629835aa90509a2bd77af33f496473131564811 |
| signature | Signed by SSH key SHA256:xbd+BjjhyBfwk7GVoURf9Yx0gzDerHbvYv7SddNWmAs |
honestly such a stupid thing like yeah i want to have 29.97 fps like no
go be a normal human being.
fixes #352 files changed, 21 insertions(+), 1 deletions(-)
lib/subprocess/ffmpeg.test.ts created+20| ... | @@ -0,0 +1,20 @@ | ||
| 1 | test("Parse uses fractional input fps for total frame estimates", () => { | ||
| 2 | const parser = new Parse(); | ||
| 3 | |||
| 4 | parser.onLine("Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':"); | ||
| 5 | parser.onLine(" Duration: 00:01:08.10, start: 0.000000, bitrate: 352 kb/s"); | ||
| 6 | parser.onLine( | ||
| 7 | " Stream #0:0[0x1](und): Video: h264, yuv420p(progressive), 160x90, 351 kb/s, 29.97 fps, 29.97 tbr, 30k tbn (default)", | ||
| 8 | ); | ||
| 9 | |||
| 10 | const result = parser.onLine( | ||
| 11 | "frame= 2041 fps=0.0 q=-1.0 Lsize=N/A time=00:01:08.10 bitrate=N/A speed= 900x", | ||
| 12 | ); | ||
| 13 | |||
| 14 | assert.equal(result.kind, "progress"); | ||
| 15 | assert.equal(result.totalFrames, 2041); | ||
| 16 | }); | ||
| 17 | |||
| 18 | import assert from "node:assert"; | ||
| 19 | import { test } from "vitest"; | ||
| 20 | import { Parse } from "./ffmpeg.ts"; | ||
lib/subprocess/ffmpeg.ts+1-1| ... | @@ -161,7 +161,7 @@ export class Parse { | ... | @@ -161,7 +161,7 @@ export class Parse { |
| 161 | ); | 161 | ); |
| 162 | } | 162 | } |
| 163 | if (!this.targetFps) { | 163 | if (!this.targetFps) { |
| 164 | const match = line.match(/^Stream.*, (\d+) fps/); | 164 | const match = line.match(/^Stream.*, (\d+(?:\.\d+)?) fps/); |
| 165 | if (match) this.targetFps = Number(match[1]); | 165 | if (match) this.targetFps = Number(match[1]); |
| 166 | } | 166 | } |
| 167 | } | 167 | } |